public void WhenChangingSavedValidatorBindingSettings_ThenPersistsChanges()
            {
                var settings = new ValidationBindingSettings
                {
                    TypeId = "Foo",
                    Properties =
                    {
                        new PropertyBindingSettings
                        {
                            Name = "Message",
                            Value = "Hello",
                        },
                        new PropertyBindingSettings
                        {
                            Name = "From",
                            ValueProvider = new ValueProviderBindingSettings
                            {
                                TypeId = "CurrentUserProvider",
                            }
                        },
                    },
                };

                ((PropertySchema)this.property).RawValidationRules = BindingSerializer.Serialize<ValidationBindingSettings[]>(new ValidationBindingSettings[] { settings });

                ((BindingSettings)this.property.ValidationSettings.First()).Properties[0].Value = "World";
                ((BindingSettings)this.property.ValidationSettings.First()).Properties[1].ValueProvider.TypeId = "AnotherProvider";

                var saved = BindingSerializer.Deserialize<ValidationBindingSettings[]>(((PropertySchema)this.property).RawValidationRules);

                Assert.Equal(1, saved.Length);
                Assert.Equal("World", saved[0].Properties[0].Value);
                Assert.Equal("AnotherProvider", saved[0].Properties[1].ValueProvider.TypeId);
            }
            public void WhenSettingValidatorBindingSettings_ThenPersistsChanges()
            {
                var settings = new ValidationBindingSettings
                {
                    TypeId = "Foo",
                    Properties =
                    {
                        new PropertyBindingSettings
                        {
                            Name = "Message",
                            Value = "Hello",
                        },
                        new PropertyBindingSettings
                        {
                            Name = "From",
                            ValueProvider = new ValueProviderBindingSettings
                            {
                                TypeId = "CurrentUserProvider",
                            }
                        },
                    },
                };

                this.property.ValidationSettings = new IBindingSettings[] { settings };

                var saved = BindingSerializer.Deserialize<ValidationBindingSettings[]>(((PropertySchema)this.property).RawValidationRules);

                Assert.Equal(1, saved.Length);
                Assert.Equal("Foo", saved[0].TypeId);
                Assert.Equal(2, saved[0].Properties.Count);
                Assert.Equal("Message", saved[0].Properties[0].Name);
                Assert.Equal("Hello", saved[0].Properties[0].Value);
                Assert.Equal("From", saved[0].Properties[1].Name);
                Assert.Equal("CurrentUserProvider", saved[0].Properties[1].ValueProvider.TypeId);
            }