Skip to content

Commit 4c875fe

Browse files
[Improve] code coverage
1 parent 628fa7d commit 4c875fe

12 files changed

Lines changed: 305 additions & 5 deletions

ReqIFSharp.Tests/AttributeValueTests/AttributeValueBooleanTestFixture.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,44 @@ namespace ReqIFSharp.Tests
2626
using System.Threading;
2727
using System.Xml;
2828

29+
using Microsoft.Extensions.Logging;
2930
using Microsoft.Extensions.Logging.Abstractions;
3031

3132
using NUnit.Framework;
3233

3334
using ReqIFSharp;
3435

36+
using Serilog;
37+
3538
/// <summary>
3639
/// Suite of tests for the <see cref="AttributeValueBoolean"/>
3740
/// </summary>
3841
[TestFixture]
3942
public class AttributeValueBooleanTestFixture
4043
{
44+
private ILoggerFactory loggerFactory;
45+
46+
[OneTimeSetUp]
47+
public void OneTimeSetUp()
48+
{
49+
Log.Logger = new LoggerConfiguration()
50+
.MinimumLevel.Verbose()
51+
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {SourceContext} - {Message:lj}{NewLine}{Exception}")
52+
.CreateLogger();
53+
54+
this.loggerFactory = LoggerFactory.Create(builder =>
55+
{
56+
builder.AddSerilog();
57+
});
58+
}
59+
60+
[Test]
61+
public void Verify_that_constructor_does_not_throw_exception()
62+
{
63+
Assert.That(() => new AttributeValueBoolean(null), Throws.Nothing);
64+
Assert.That(() => new AttributeValueBoolean(this.loggerFactory), Throws.Nothing);
65+
}
66+
4167
[Test]
4268
public void Verify_That_The_AttributeDefinition_Can_Be_Set_Or_Get()
4369
{

ReqIFSharp.Tests/AttributeValueTests/AttributeValueDateTestFixture.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,37 @@ namespace ReqIFSharp.Tests
2626
using System.Threading;
2727
using System.Xml;
2828

29+
using Microsoft.Extensions.Logging;
2930
using Microsoft.Extensions.Logging.Abstractions;
3031

3132
using NUnit.Framework;
3233

3334
using ReqIFSharp;
3435

36+
using Serilog;
37+
3538
/// <summary>
3639
/// Suite of tests for the <see cref="AttributeValueDate"/>
3740
/// </summary>
3841
[TestFixture]
3942
public class AttributeValueDateTestFixture
4043
{
44+
private ILoggerFactory loggerFactory;
45+
46+
[OneTimeSetUp]
47+
public void OneTimeSetUp()
48+
{
49+
Log.Logger = new LoggerConfiguration()
50+
.MinimumLevel.Verbose()
51+
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {SourceContext} - {Message:lj}{NewLine}{Exception}")
52+
.CreateLogger();
53+
54+
this.loggerFactory = LoggerFactory.Create(builder =>
55+
{
56+
builder.AddSerilog();
57+
});
58+
}
59+
4160
[Test]
4261
public void Verify_That_The_AttributeDefinition_Can_Be_Set_Or_Get()
4362
{

ReqIFSharp.Tests/AttributeValueTests/AttributeValueEnumerationTestFixture.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,43 @@ namespace ReqIFSharp.Tests
2727
using System.Threading;
2828
using System.Xml;
2929

30+
using Microsoft.Extensions.Logging;
31+
3032
using NUnit.Framework;
3133

3234
using ReqIFSharp;
3335

36+
using Serilog;
37+
3438
/// <summary>
3539
/// Suite of tests for the <see cref="AttributeValueEnumeration"/>
3640
/// </summary>
3741
[TestFixture]
3842
public class AttributeValueEnumerationTestFixture
3943
{
44+
private ILoggerFactory loggerFactory;
45+
46+
[OneTimeSetUp]
47+
public void OneTimeSetUp()
48+
{
49+
Log.Logger = new LoggerConfiguration()
50+
.MinimumLevel.Verbose()
51+
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {SourceContext} - {Message:lj}{NewLine}{Exception}")
52+
.CreateLogger();
53+
54+
this.loggerFactory = LoggerFactory.Create(builder =>
55+
{
56+
builder.AddSerilog();
57+
});
58+
}
59+
60+
[Test]
61+
public void Verify_that_constructor_does_not_throw_exception()
62+
{
63+
Assert.That(() => new AttributeValueEnumeration(null), Throws.Nothing);
64+
Assert.That(() => new AttributeValueEnumeration(this.loggerFactory), Throws.Nothing);
65+
}
66+
4067
[Test]
4168
public void Verify_That_The_AttributeDefinition_Can_Be_Set_Or_Get()
4269
{

ReqIFSharp.Tests/AttributeValueTests/AttributeValueIntegerTestFixture.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,44 @@ namespace ReqIFSharp.Tests
2626
using System.Threading;
2727
using System.Xml;
2828

29+
using Microsoft.Extensions.Logging;
2930
using Microsoft.Extensions.Logging.Abstractions;
3031

3132
using NUnit.Framework;
3233

3334
using ReqIFSharp;
3435

36+
using Serilog;
37+
3538
/// <summary>
3639
/// Suite of tests for the <see cref="AttributeValueInteger"/>
3740
/// </summary>
3841
[TestFixture]
3942
public class AttributeValueIntegerTestFixture
4043
{
44+
private ILoggerFactory loggerFactory;
45+
46+
[OneTimeSetUp]
47+
public void OneTimeSetUp()
48+
{
49+
Log.Logger = new LoggerConfiguration()
50+
.MinimumLevel.Verbose()
51+
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {SourceContext} - {Message:lj}{NewLine}{Exception}")
52+
.CreateLogger();
53+
54+
this.loggerFactory = LoggerFactory.Create(builder =>
55+
{
56+
builder.AddSerilog();
57+
});
58+
}
59+
60+
[Test]
61+
public void Verify_that_constructor_does_not_throw_exception()
62+
{
63+
Assert.That(() => new AttributeValueInteger(null), Throws.Nothing);
64+
Assert.That(() => new AttributeValueInteger(this.loggerFactory), Throws.Nothing);
65+
}
66+
4167
[Test]
4268
public void Verify_That_The_AttributeDefinition_Can_Be_Set_Or_Get()
4369
{

ReqIFSharp.Tests/AttributeValueTests/AttributeValueRealTestFixture.cs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ namespace ReqIFSharp.Tests
3333

3434
using ReqIFSharp;
3535

36+
using Serilog;
37+
3638
/// <summary>
3739
/// Suite of tests for the <see cref="AttributeValueReal"/>
3840
/// </summary>
@@ -41,10 +43,25 @@ public class AttributeValueRealTestFixture
4143
{
4244
private ILoggerFactory loggerFactory;
4345

44-
[SetUp]
45-
public void SetUp()
46+
[OneTimeSetUp]
47+
public void OneTimeSetUp()
48+
{
49+
Log.Logger = new LoggerConfiguration()
50+
.MinimumLevel.Verbose()
51+
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {SourceContext} - {Message:lj}{NewLine}{Exception}")
52+
.CreateLogger();
53+
54+
this.loggerFactory = LoggerFactory.Create(builder =>
55+
{
56+
builder.AddSerilog();
57+
});
58+
}
59+
60+
[Test]
61+
public void Verify_that_constructor_does_not_throw_exception()
4662
{
47-
this.loggerFactory = LoggerFactory.Create(builder => builder.AddConsole());
63+
Assert.That(() => new AttributeValueReal(null), Throws.Nothing);
64+
Assert.That(() => new AttributeValueReal(this.loggerFactory), Throws.Nothing);
4865
}
4966

5067
[Test]

ReqIFSharp.Tests/AttributeValueTests/AttributeValueStringTestFixture.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,43 @@ namespace ReqIFSharp.Tests
2626
using System.Threading;
2727
using System.Xml;
2828

29+
using Microsoft.Extensions.Logging;
30+
2931
using NUnit.Framework;
3032

3133
using ReqIFSharp;
3234

35+
using Serilog;
36+
3337
/// <summary>
3438
/// Suite of tests for the <see cref="AttributeValueString"/>
3539
/// </summary>
3640
[TestFixture]
3741
public class AttributeValueStringTestFixture
3842
{
43+
private ILoggerFactory loggerFactory;
44+
45+
[OneTimeSetUp]
46+
public void OneTimeSetUp()
47+
{
48+
Log.Logger = new LoggerConfiguration()
49+
.MinimumLevel.Verbose()
50+
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {SourceContext} - {Message:lj}{NewLine}{Exception}")
51+
.CreateLogger();
52+
53+
this.loggerFactory = LoggerFactory.Create(builder =>
54+
{
55+
builder.AddSerilog();
56+
});
57+
}
58+
59+
[Test]
60+
public void Verify_that_constructor_does_not_throw_exception()
61+
{
62+
Assert.That(() => new AttributeValueString(null), Throws.Nothing);
63+
Assert.That(() => new AttributeValueString(this.loggerFactory), Throws.Nothing);
64+
}
65+
3966
[Test]
4067
public void Verify_That_The_AttributeDefinition_Can_Be_Set_Or_Get()
4168
{

ReqIFSharp.Tests/AttributeValueTests/AttributeValueXHTMLTestFixture.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,43 @@ namespace ReqIFSharp.Tests
2626
using System.Threading;
2727
using System.Xml;
2828

29+
using Microsoft.Extensions.Logging;
30+
2931
using NUnit.Framework;
3032

3133
using ReqIFSharp;
3234

35+
using Serilog;
36+
3337
/// <summary>
3438
/// Suite of tests for the <see cref="AttributeValueXHTML"/>
3539
/// </summary>
3640
[TestFixture]
3741
public class AttributeValueXHTMLTestFixture
3842
{
43+
private ILoggerFactory loggerFactory;
44+
45+
[OneTimeSetUp]
46+
public void OneTimeSetUp()
47+
{
48+
Log.Logger = new LoggerConfiguration()
49+
.MinimumLevel.Verbose()
50+
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {SourceContext} - {Message:lj}{NewLine}{Exception}")
51+
.CreateLogger();
52+
53+
this.loggerFactory = LoggerFactory.Create(builder =>
54+
{
55+
builder.AddSerilog();
56+
});
57+
}
58+
59+
[Test]
60+
public void Verify_that_constructor_does_not_throw_exception()
61+
{
62+
Assert.That(() => new AttributeValueXHTML(null), Throws.Nothing);
63+
Assert.That(() => new AttributeValueXHTML(this.loggerFactory), Throws.Nothing);
64+
}
65+
3966
[Test]
4067
public void Verify_That_The_AttributeDefinition_Can_Be_Set_Or_Get()
4168
{

ReqIFSharp.Tests/Datatype/DatatypeDefinitionDateTestFixture.cs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,36 @@ namespace ReqIFSharp.Tests.Datatype
2424
using System.Collections.Generic;
2525
using System.IO;
2626
using System.Linq;
27-
27+
28+
using Microsoft.Extensions.Logging;
29+
2830
using NUnit.Framework;
2931

3032
using ReqIFSharp;
3133

34+
using Serilog;
35+
3236
[TestFixture]
3337
public class DatatypeDefinitionDateTestFixture
3438
{
3539
private string resultFileUri;
3640

41+
private ILoggerFactory loggerFactory;
42+
43+
[OneTimeSetUp]
44+
public void OneTimeSetUp()
45+
{
46+
Log.Logger = new LoggerConfiguration()
47+
.MinimumLevel.Verbose()
48+
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {SourceContext} - {Message:lj}{NewLine}{Exception}")
49+
.CreateLogger();
50+
51+
this.loggerFactory = LoggerFactory.Create(builder =>
52+
{
53+
builder.AddSerilog();
54+
});
55+
}
56+
3757
[SetUp]
3858
public void SetUp()
3959
{
@@ -46,6 +66,13 @@ public void TearDown()
4666
File.Delete(this.resultFileUri);
4767
}
4868

69+
[Test]
70+
public void Verify_that_constructor_does_not_throw_exception()
71+
{
72+
Assert.That(() => new DatatypeDefinitionDate(null), Throws.Nothing);
73+
Assert.That(() => new DatatypeDefinitionDate(this.loggerFactory), Throws.Nothing);
74+
}
75+
4976
[Test]
5077
public void Verify_that_DatatypeDefinitionDate_can_be_serialized_and_deserialized()
5178
{

ReqIFSharp.Tests/Datatype/DatatypeDefinitionIntegerTestFixture.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,41 @@ namespace ReqIFSharp.Tests
2525
using System.Runtime.Serialization;
2626
using System.Xml;
2727

28+
using Microsoft.Extensions.Logging;
2829
using Microsoft.Extensions.Logging.Abstractions;
2930

3031
using NUnit.Framework;
3132

3233
using ReqIFSharp;
3334

35+
using Serilog;
36+
3437
[TestFixture]
3538
public class DatatypeDefinitionIntegerTestFixture
3639
{
40+
private ILoggerFactory loggerFactory;
41+
42+
[OneTimeSetUp]
43+
public void OneTimeSetUp()
44+
{
45+
Log.Logger = new LoggerConfiguration()
46+
.MinimumLevel.Verbose()
47+
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {SourceContext} - {Message:lj}{NewLine}{Exception}")
48+
.CreateLogger();
49+
50+
this.loggerFactory = LoggerFactory.Create(builder =>
51+
{
52+
builder.AddSerilog();
53+
});
54+
}
55+
56+
[Test]
57+
public void Verify_that_constructor_does_not_throw_exception()
58+
{
59+
Assert.That(() => new DatatypeDefinitionInteger(null), Throws.Nothing);
60+
Assert.That(() => new DatatypeDefinitionInteger(this.loggerFactory), Throws.Nothing);
61+
}
62+
3763
[Test]
3864
public void Verify_that_when_MAX_is_too_large_exception_is_thrown()
3965
{

0 commit comments

Comments
 (0)