Skip to content

Commit

Permalink
ConfigurationItemFactory - Added code coverage for Factory RegisterDe…
Browse files Browse the repository at this point in the history
…finition (#5367)
  • Loading branch information
snakefoot authored Oct 10, 2023
1 parent 528b75b commit 1a02796
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/NLog.UnitTests/Config/ConfigurationItemFactoryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ public void ConfigurationItemFactoryFailsTest()
var itemFactory = new ConfigurationItemFactory();
var ex = Assert.ThrowsAny<Exception>(() => itemFactory.GetTargetFactory().CreateInstance("Memory-Target") as MemoryTarget);
Assert.Contains("Memory-Target", ex.Message);

itemFactory.GetTargetFactory().RegisterDefinition(nameof(MemoryTarget), typeof(MemoryTarget));
var result = itemFactory.GetTargetFactory().CreateInstance("Memory-Target");
Assert.IsType<MemoryTarget>(result);
}

[Fact]
Expand Down

0 comments on commit 1a02796

Please sign in to comment.