-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
41f657f
commit 51e479e
Showing
2 changed files
with
306 additions
and
93 deletions.
There are no files selected for viewing
87 changes: 87 additions & 0 deletions
87
uml4net.Reporting.Tests/Generators/XlReportGeneratorTestFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// ------------------------------------------------------------------------------------------------- | ||
// <copyright file="XlReportGeneratorTestFixture.cs" company="Starion Group S.A."> | ||
// | ||
// Copyright 2019-2024 Starion Group S.A. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// </copyright> | ||
// ------------------------------------------------------------------------------------------------ | ||
|
||
namespace uml4net.Reporting.Tests.Generators | ||
{ | ||
using System.Collections.Generic; | ||
using System.IO; | ||
|
||
using Microsoft.Extensions.Logging; | ||
|
||
using NUnit.Framework; | ||
|
||
using Reporting.Generators; | ||
|
||
using Serilog; | ||
|
||
[TestFixture] | ||
public class XlReportGeneratorTestFixture | ||
{ | ||
private ILoggerFactory loggerFactory; | ||
|
||
private XlReportGenerator xlReportGenerator; | ||
|
||
private FileInfo umlModelFileInfo; | ||
|
||
private FileInfo sysml2ModelFileInfo; | ||
|
||
[SetUp] | ||
public void SetUp() | ||
{ | ||
Log.Logger = new LoggerConfiguration() | ||
.MinimumLevel.Verbose() | ||
.WriteTo.Console() | ||
.CreateLogger(); | ||
|
||
this.loggerFactory = LoggerFactory.Create(builder => | ||
{ | ||
builder.AddSerilog(); | ||
}); | ||
|
||
this.umlModelFileInfo = new FileInfo(Path.Combine(TestContext.CurrentContext.TestDirectory, "TestData", "UML.xmi")); | ||
this.sysml2ModelFileInfo = new FileInfo(Path.Combine(TestContext.CurrentContext.TestDirectory, "TestData", "SysML.uml")); | ||
} | ||
|
||
[Test] | ||
public void Verify_that_the_report_generator_generates_a_report_of_uml() | ||
{ | ||
this.xlReportGenerator = new XlReportGenerator(this.loggerFactory); | ||
|
||
var reportFileInfo = new FileInfo(Path.Combine(TestContext.CurrentContext.TestDirectory, "uml-xl-report.xlsx")); | ||
|
||
var pathmap = new Dictionary<string, string>(); | ||
|
||
Assert.That(() => this.xlReportGenerator.GenerateReport(this.umlModelFileInfo, this.umlModelFileInfo.Directory, pathmap, reportFileInfo), Throws.Nothing); | ||
} | ||
|
||
[Test] | ||
public void Verify_that_the_report_generator_generates_a_report_of_sysml2() | ||
{ | ||
this.xlReportGenerator = new XlReportGenerator(this.loggerFactory); | ||
|
||
var reportFileInfo = new FileInfo(Path.Combine(TestContext.CurrentContext.TestDirectory, "sysml2-xl-report.xlsx")); | ||
|
||
var pathmap = new Dictionary<string, string>(); | ||
pathmap.Add("pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml", Path.Combine("TestData", "PrimitiveTypes.xmi")); | ||
|
||
Assert.That(() => this.xlReportGenerator.GenerateReport(this.sysml2ModelFileInfo, this.umlModelFileInfo.Directory, pathmap, reportFileInfo), Throws.Nothing); | ||
} | ||
} | ||
} |
Oops, something went wrong.