public void DeserializeHostSecrets_ReturnsExpectedResult()
        {
            var serializer       = new ScriptSecretSerializerV0();
            var serializedSecret = "{'masterKey': 'master', 'functionKey': 'master'}";
            var expected         = new HostSecrets
            {
                MasterKey = new Key {
                    Name = ScriptConstants.DefaultMasterKeyName, Value = "master"
                },
                FunctionKeys = new List <Key>
                {
                    new Key
                    {
                        Name        = ScriptConstants.DefaultFunctionKeyName,
                        Value       = "master",
                        IsEncrypted = false
                    }
                }
            };

            HostSecrets actual = serializer.DeserializeSecrets <HostSecrets>(JObject.Parse(serializedSecret));

            Assert.NotNull(actual);
            Assert.Equal(expected.MasterKey, actual.MasterKey);
            AssertKeyCollectionsEquality(expected.FunctionKeys, actual.FunctionKeys);
        }
        public void DeserializeFunctionSecrets_ReturnsExpectedResult()
        {
            var serializer = new ScriptSecretSerializerV0();
            var serializedSecret = "{ 'key': 'TestValue' }";

            var expected = new List<Key>
            {
                new Key
                {
                    Name = ScriptConstants.DefaultFunctionKeyName,
                    Value = "TestValue",
                    IsEncrypted = false
                }
            };

            FunctionSecrets actual = serializer.DeserializeSecrets<FunctionSecrets>(JObject.Parse(serializedSecret));
            AssertKeyCollectionsEquality(expected, actual.Keys);
        }
        public void DeserializeFunctionSecrets_ReturnsExpectedResult()
        {
            var serializer       = new ScriptSecretSerializerV0();
            var serializedSecret = "{ 'key': 'TestValue' }";

            var expected = new List <Key>
            {
                new Key
                {
                    Name        = ScriptConstants.DefaultFunctionKeyName,
                    Value       = "TestValue",
                    IsEncrypted = false
                }
            };

            FunctionSecrets actual = serializer.DeserializeSecrets <FunctionSecrets>(JObject.Parse(serializedSecret));

            AssertKeyCollectionsEquality(expected, actual.Keys);
        }
        public void DeserializeHostSecrets_ReturnsExpectedResult()
        {
            var serializer = new ScriptSecretSerializerV0();
            var serializedSecret = "{'masterKey': 'master', 'functionKey': 'master'}";
            var expected = new HostSecrets
            {
                MasterKey = new Key { Name = ScriptConstants.DefaultMasterKeyName, Value = "master" },
                FunctionKeys = new List<Key>
                {
                    new Key
                    {
                        Name = ScriptConstants.DefaultFunctionKeyName,
                        Value = "master",
                        IsEncrypted = false
                    }
                }
            };

            HostSecrets actual = serializer.DeserializeSecrets<HostSecrets>(JObject.Parse(serializedSecret));

            Assert.NotNull(actual);
            Assert.Equal(expected.MasterKey, actual.MasterKey);
            AssertKeyCollectionsEquality(expected.FunctionKeys, actual.FunctionKeys);
        }