public void ParsesNestedObjects() { var input = @" { ""Key1"": { ""nested"" : ""value"" }, ""array"": [ 1, 2 ] }"; var testConsole = new TestConsole(_output) { IsInputRedirected = true, In = new StringReader(input) }; var secretStore = new TestSecretsStore(_output); var command = new SetCommand.FromStdInStrategy(); command.Execute(new CommandContext(secretStore, new TestReporter(_output), testConsole)); Assert.Equal(3, secretStore.Count); Assert.True(secretStore.ContainsKey("Key1:nested")); Assert.Equal("value", secretStore["Key1:nested"]); Assert.Equal("1", secretStore["array:0"]); Assert.Equal("2", secretStore["array:1"]); }
public void SetsFromPipedInput() { var input = @" { ""Key1"": ""str value"", ""Key2"": 1234, ""Key3"": false }"; var testConsole = new TestConsole(_output) { IsInputRedirected = true, In = new StringReader(input) }; var secretStore = new TestSecretsStore(_output); var command = new SetCommand.FromStdInStrategy(); command.Execute(new CommandContext(secretStore, new TestReporter(_output), testConsole)); Assert.Equal(3, secretStore.Count); Assert.Equal("str value", secretStore["Key1"]); Assert.Equal("1234", secretStore["Key2"]); Assert.Equal("False", secretStore["Key3"]); }