Skip to content

Commit

Permalink
Allow adding a ConfigNode.Value in initializer
Browse files Browse the repository at this point in the history
Not useful yet but maybe at some point
  • Loading branch information
blowfishpro committed Sep 24, 2017
1 parent eb18b60 commit 4fdfb89
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions TestUtils/TestConfigNode.cs
Expand Up @@ -9,6 +9,7 @@ public class TestConfigNode : ConfigNode, IEnumerable
public TestConfigNode(string name) : base(name) { }

public void Add(string name, string value) => AddValue(name, value);
public void Add(ConfigNode.Value value) => values.Add(value);
public void Add(string name, ConfigNode node) => AddNode(name, node);
public void Add(ConfigNode node) => AddNode(node);

Expand Down
2 changes: 2 additions & 0 deletions TestUtilsTests/TestConfigNodeTest.cs
Expand Up @@ -15,6 +15,7 @@ public void TestTestConfigNode()
{ "value2", "something else" },
{ "multiple", "first" },
{ "multiple", "second" },
new ConfigNode.Value("foo", "bar"),
{ "NODE_1", new TestConfigNode
{
{ "name", "something" },
Expand All @@ -36,6 +37,7 @@ public void TestTestConfigNode()
Assert.Equal("something", node.GetValue("value1"));
Assert.Equal("something else", node.GetValue("value2"));
Assert.Equal(new[] { "first", "second" }, node.GetValues("multiple"));
Assert.Equal("bar", node.GetValue("foo"));

ConfigNode innerNode1 = node.GetNode("NODE_1");
Assert.NotNull(innerNode1);
Expand Down

0 comments on commit 4fdfb89

Please sign in to comment.