|
| 1 | +// ------------------------------------------------------------------------------------------------- |
| 2 | +// <copyright file="ResourceLoaderTestFixture.cs" company="Starion Group S.A."> |
| 3 | +// |
| 4 | +// Copyright 2019-2026 Starion Group S.A. |
| 5 | +// |
| 6 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | +// you may not use this file except in compliance with the License. |
| 8 | +// You may obtain a copy of the License at |
| 9 | +// |
| 10 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +// |
| 12 | +// Unless required by applicable law or agreed to in writing, software |
| 13 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | +// See the License for the specific language governing permissions and |
| 16 | +// limitations under the License. |
| 17 | +// |
| 18 | +// </copyright> |
| 19 | +// ------------------------------------------------------------------------------------------------ |
| 20 | + |
| 21 | +namespace ECoreNetto.Tools.Tests.Resources |
| 22 | +{ |
| 23 | + using System; |
| 24 | + |
| 25 | + using NUnit.Framework; |
| 26 | + |
| 27 | + using ECoreNetto.Tools.Resources; |
| 28 | + |
| 29 | + /// <summary> |
| 30 | + /// Test fixture for the <see cref="ResourceLoader"/> class. |
| 31 | + /// </summary> |
| 32 | + [TestFixture] |
| 33 | + public class ResourceLoaderTestFixture |
| 34 | + { |
| 35 | + [Test] |
| 36 | + public void LoadEmbeddedResource_WithValidPath_ReturnsContent() |
| 37 | + { |
| 38 | + var resourcePath = "ECoreNetto.Tools.Resources.ascii-art.txt"; |
| 39 | + |
| 40 | + var content = ResourceLoader.LoadEmbeddedResource(resourcePath); |
| 41 | + |
| 42 | + Assert.That(content, Is.Not.Null.And.Not.Empty); |
| 43 | + } |
| 44 | + |
| 45 | + [Test] |
| 46 | + public void LoadEmbeddedResource_WithNullPath_ThrowsArgumentNullException() |
| 47 | + { |
| 48 | + Assert.That(() => ResourceLoader.LoadEmbeddedResource(null!), |
| 49 | + Throws.TypeOf<ArgumentNullException>()); |
| 50 | + } |
| 51 | + |
| 52 | + [Test] |
| 53 | + public void QueryVersion_ReturnsNonNullVersion() |
| 54 | + { |
| 55 | + var version = ResourceLoader.QueryVersion(); |
| 56 | + |
| 57 | + Assert.That(version, Is.Not.Null.And.Not.Empty); |
| 58 | + Assert.That(version, Does.Match(@"^\d+\.\d+\.\d+\.\d+$")); |
| 59 | + } |
| 60 | + |
| 61 | + [Test] |
| 62 | + public void QueryLogo_ReturnsLogoWithVersion() |
| 63 | + { |
| 64 | + var version = ResourceLoader.QueryVersion(); |
| 65 | + |
| 66 | + var logo = ResourceLoader.QueryLogo(); |
| 67 | + |
| 68 | + Assert.That(logo, Is.Not.Null.And.Not.Empty); |
| 69 | + Assert.That(logo, Does.Contain(version)); |
| 70 | + } |
| 71 | + } |
| 72 | +} |
0 commit comments