Skip to content

Commit 414cd80

Browse files
committed
wip
1 parent 15ab8fa commit 414cd80

File tree

3 files changed

+5
-24
lines changed

3 files changed

+5
-24
lines changed

src/libraries/Microsoft.Extensions.Configuration.Json/src/JsonConfigurationFileParser.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@ private void VisitElement(JsonElement element)
5757

5858
if (isEmpty)
5959
{
60-
//EnterContext("");
61-
//_data[_currentPath] = "";
62-
//ExitContext();
63-
64-
// when the object has no properties, we still want to have it as section
6560
_data[_currentPath] = null;
6661
}
6762
}

src/libraries/Microsoft.Extensions.Configuration.Json/tests/IntegrationTest.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,24 +44,6 @@ public void LoadJsonConfiguration()
4444
x => AssertSection(x, "k", null),
4545
}),
4646
});
47-
48-
//Assert.Collection(configuration.GetChildren(),
49-
// new Action<IConfigurationSection>[] {
50-
// x => AssertSection(x, "a", "b"),
51-
// x => AssertSection(x, "c", null, new Action<IConfigurationSection>[] {
52-
// x => AssertSection(x, "d", "e"),
53-
// }),
54-
// x => AssertSection(x, "f", ""),
55-
// x => AssertSection(x, "g", ""),
56-
// x => AssertSection(x, "h", null, new Action<IConfigurationSection>[] {
57-
// x => AssertSection(x, "", ""),
58-
// }),
59-
// x => AssertSection(x, "i", null, new Action<IConfigurationSection>[] {
60-
// x => AssertSection(x, "k", null, new Action<IConfigurationSection>[] {
61-
// x => AssertSection(x, "", ""),
62-
// }),
63-
// }),
64-
//});
6547
}
6648

6749
private static void AssertSection(IConfigurationSection configurationSection, string key, string value)

src/libraries/Microsoft.Extensions.Configuration/tests/ConfigurationTest.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ public void KeyWithValueAndWithoutChildrenExistsAsSection(string value)
791791
}
792792

793793
[Fact]
794-
public void KeyWithNullValueAndWithoutChildrenIsNotASection()
794+
public void KeyWithNullValueAndWithoutChildrenIsASectionButNotExists()
795795
{
796796
// Arrange
797797
var dict = new Dictionary<string, string>()
@@ -803,10 +803,14 @@ public void KeyWithNullValueAndWithoutChildrenIsNotASection()
803803
var config = configurationBuilder.Build();
804804

805805
// Act
806+
var sections = config.GetChildren();
806807
var sectionExists = config.GetSection("Mem1").Exists();
808+
var sectionChildren = config.GetSection("Mem1").GetChildren();
807809

808810
// Assert
811+
Assert.Single(sections, section => section.Key == "Mem1");
809812
Assert.False(sectionExists);
813+
Assert.Empty(sectionChildren);
810814
}
811815

812816
[Fact]

0 commit comments

Comments
 (0)