Skip to content

Commit 63fef6c

Browse files
[Improve] coverage
1 parent 0eeba67 commit 63fef6c

2 files changed

Lines changed: 95 additions & 0 deletions

File tree

ECoreNetto.Reporting.Tests/Generators/HtmlReportGeneratorTestFixture.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,28 @@ public void Verify_that_the_report_generator_generates_a_report(string model)
7272

7373
Assert.That(() => this.htmlReportGenerator.GenerateReport(modelFileInfo, reportFileInfo), Throws.Nothing);
7474
}
75+
76+
[Test]
77+
public void Verify_that_when_modelpath_is_null_exception_is_thrown()
78+
{
79+
FileInfo modelFileInfo = null;
80+
81+
Assert.That(() => this.htmlReportGenerator.GenerateReport(modelFileInfo), Throws.ArgumentNullException);
82+
83+
var reportFileInfo = new FileInfo(Path.Combine(TestContext.CurrentContext.TestDirectory, "html-report.ecore.html"));
84+
85+
Assert.That(() => this.htmlReportGenerator.GenerateReport(modelFileInfo, reportFileInfo), Throws.ArgumentNullException);
86+
87+
modelFileInfo = new FileInfo(Path.Combine(TestContext.CurrentContext.TestDirectory, "Data", "recipe.ecore"));
88+
reportFileInfo = null;
89+
90+
Assert.That(() => this.htmlReportGenerator.GenerateReport(modelFileInfo, reportFileInfo), Throws.ArgumentNullException);
91+
}
92+
93+
[Test]
94+
public void Verify_That_when_outputpath_is_null_exception_is_thrown()
95+
{
96+
Assert.That(() => this.htmlReportGenerator.IsValidReportExtension(null), Throws.ArgumentNullException);
97+
}
7598
}
7699
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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

Comments
 (0)