Esempio n. 1
0
        private bool PasswordIsIncorrect()
        {
            if (!_deployUnit.HasDeployParameters)
            {
                return(false);
            }

            foreach (var parameter in _deployUnit.GetDeployParameters())
            {
                var passwordParameter = parameter as PasswordActionParameter;
                if (passwordParameter == null)
                {
                    continue;
                }
                if (string.IsNullOrEmpty(passwordParameter.Password))
                {
                    continue;
                }

                var suppliedPassword = _parameterValues.GetValue(passwordParameter.Name);
                return(suppliedPassword != passwordParameter.Password);
            }

            return(false);
        }
Esempio n. 2
0
        public void can_deserialize_and_work_with_dynamic_with_nested_types()
        {
            var     parameters = new ExpandoObject();
            dynamic value      = new ExpandoObject();

            value.prop1 = "test";
            value.prop2 = "test2";
            ((IDictionary <string, object>)parameters)["Test"] = value;

            var     json         = JsonConvert.SerializeObject(parameters);
            dynamic deserialized = JsonConvert.DeserializeObject <IDictionary <string, object> >(json);

            var expando = new ParameterValues(parameters);

            ((string)expando.GetValue("Test").prop1).ShouldBe("test");
            ((string)expando.GetValue("Test").prop2).ShouldBe("test2");

            var fromJson = new ParameterValues(deserialized);

            ((string)fromJson.GetValue("Test").prop1).ShouldBe("test");
            ((string)fromJson.GetValue("Test").prop2).ShouldBe("test2");
        }