Ejemplo n.º 1
0
        public void ShouldChangeBackgroundOnValidationError()
        {
            var element    = new TextBox();
            var background = new SolidColorBrush();
            var model      = new MockModel();

            OnValidationError.SetToggleBackground(element, background);
            CreateBindingThatValidatesOnExceptions(element, model);

            element.Text = "InvalidValue";

            Assert.AreEqual(background, element.Background);
        }
Ejemplo n.º 2
0
        public void ShouldChangeToOriginalBackgroundErrorRemoved()
        {
            var element            = new TextBox();
            var originalBackground = new SolidColorBrush();

            element.Background = originalBackground;
            var model = new MockModel();

            OnValidationError.SetToggleBackground(element, new SolidColorBrush());
            CreateBindingThatValidatesOnExceptions(element, model);
            element.Text = "InvalidValue";
            Assert.AreNotEqual(originalBackground, element.Background);

            element.Text = "ValidValue";

            Assert.AreEqual(originalBackground, element.Background);
        }