public void SerializeFunctionSecrets_ReturnsExpectedResult() { var serializer = new ScriptSecretSerializerV0(); var secrets = new FunctionSecrets { Keys = new List <Key> { new Key { Name = string.Empty, Value = "Value1", IsEncrypted = false }, new Key { Name = "Key2", Value = "Value2", IsEncrypted = true } } }; string serializedSecret = serializer.SerializeSecrets(secrets); Assert.NotNull(serializedSecret); var jsonObject = JObject.Parse(serializedSecret); var serializedSecretValue = jsonObject.Value <string>("key"); Assert.Equal("Value1", serializedSecretValue); }
public void SerializeHostSecrets_ReturnsExpectedResult() { var serializer = new ScriptSecretSerializerV0(); var secrets = new HostSecrets { MasterKey = new Key { Name = "master", Value = "mastervalue" }, FunctionKeys = new List <Key> { new Key { Name = string.Empty, Value = "functionKeyValue", IsEncrypted = false, } } }; string serializedSecret = serializer.SerializeSecrets(secrets); Assert.NotNull(serializedSecret); var jsonObject = JObject.Parse(serializedSecret); var functionKey = jsonObject.Value <string>("functionKey"); var masterKey = jsonObject.Value <string>("masterKey"); Assert.Equal("mastervalue", masterKey); Assert.Equal("functionKeyValue", functionKey); }
public void SerializeFunctionSecrets_ReturnsExpectedResult() { var serializer = new ScriptSecretSerializerV0(); var secrets = new FunctionSecrets { Keys = new List<Key> { new Key { Name = string.Empty, Value = "Value1", IsEncrypted = false }, new Key { Name = "Key2", Value = "Value2", IsEncrypted = true } } }; string serializedSecret = serializer.SerializeSecrets(secrets); Assert.NotNull(serializedSecret); var jsonObject = JObject.Parse(serializedSecret); var serializedSecretValue = jsonObject.Value<string>("key"); Assert.Equal("Value1", serializedSecretValue); }
public void SerializeHostSecrets_ReturnsExpectedResult() { var serializer = new ScriptSecretSerializerV0(); var secrets = new HostSecrets { MasterKey = new Key { Name = "master", Value = "mastervalue" }, FunctionKeys = new List<Key> { new Key { Name = string.Empty, Value = "functionKeyValue", IsEncrypted = false, } } }; string serializedSecret = serializer.SerializeSecrets(secrets); Assert.NotNull(serializedSecret); var jsonObject = JObject.Parse(serializedSecret); var functionKey = jsonObject.Value<string>("functionKey"); var masterKey = jsonObject.Value<string>("masterKey"); Assert.Equal("mastervalue", masterKey); Assert.Equal("functionKeyValue", functionKey); }