Skip to content

Commit 41b18da

Browse files
(#177) Attempt at creating a regression test
1 parent 3f6740a commit 41b18da

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

src/Stravaig.Configuration.Diagnostics.AdHocTests/Stravaig.Configuration.Diagnostics.AdHocTests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
55
<IsPackable>false</IsPackable>
66
<RootNamespace>Stravaig.Extensions.Configuration.Diagnostics.AdHocTests</RootNamespace>
7+
<LangVersion>10</LangVersion>
78
</PropertyGroup>
89

910
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System.Collections.Generic;
2+
using Microsoft.Extensions.Configuration;
3+
using NUnit.Framework;
4+
using Stravaig.Configuration.Diagnostics.Logging;
5+
using Stravaig.Extensions.Logging.Diagnostics.Render;
6+
7+
namespace Stravaig.Extensions.Configuration.Diagnostics.Tests.RegressionTests;
8+
9+
[TestFixture]
10+
public class EmptyKeyConfigTests : LoggerExtensionsTestBase
11+
{
12+
[Test]
13+
public void TwoEmptyKeys()
14+
{
15+
SetupConfig(c =>
16+
{
17+
c.AddInMemoryCollection(new[]
18+
{
19+
//new KeyValuePair<string, string>("", "This key is empty"),
20+
new KeyValuePair<string, string>(":EmptyTopLevel", "The top level key is empty"),
21+
new KeyValuePair<string, string>("A:Regular:Key", "This is a normal key"),
22+
});
23+
});
24+
SetupLogger();
25+
26+
Logger.LogConfigurationValuesAsInformation(ConfigRoot);
27+
28+
var logs = GetLogs();
29+
logs.RenderLogs(Formatter.SimpleBySequence, Sink.Console);
30+
31+
}
32+
33+
}

src/Stravaig.Configuration.Diagnostics.Tests/Stravaig.Configuration.Diagnostics.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
55
<IsPackable>false</IsPackable>
66
<RootNamespace>Stravaig.Extensions.Configuration.Diagnostics.Tests</RootNamespace>
7+
<LangVersion>10</LangVersion>
78
</PropertyGroup>
89

910
<ItemGroup>

0 commit comments

Comments
 (0)