Skip to content

Commit 8fe0149

Browse files
Improve coverage for StandardLoggerFactory.
1 parent c2db1ef commit 8fe0149

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

Take2/NuLog.Tests/Unit/Factories/StandardLoggerFactoryUnitTests.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,25 @@ public void Should_NotThrowExceptionForBadFallbackLogger() {
476476
// Verify
477477
Assert.True(this.traceListener.Messages.Any(m => m.Contains("Failed to get fallback logger for cause: ")), "No message was traced warning of the failed construction of the fallback logger.");
478478
}
479+
480+
[Fact(DisplayName = "Should_NotAllowGetLoggerAfterDispose")]
481+
public void Should_NotAllowGetLoggerAfterDispose() {
482+
// Setup
483+
var targetConfig = new TargetConfig {
484+
Name = "broken",
485+
Type = "NuLog.Tests.Unit.Factories.BrokenTarget, NuLog.Tests"
486+
};
487+
var configs = new List<TargetConfig> { targetConfig };
488+
var config = new Config {
489+
Targets = configs
490+
};
491+
492+
var factory = GetLogFactory(config);
493+
factory.Dispose();
494+
495+
// Execute/Validate
496+
Assert.Throws<InvalidOperationException>(() => factory.GetLogger(null, null));
497+
}
479498
}
480499

481500
/// <summary>

0 commit comments

Comments
 (0)