Exemplo n.º 1
0
        public void TestDeepValid()
        {
            IClassValidator formValidator = GetClassValidator(typeof(Form));

            Address a = new Address();
            Member m = new Member();
            m.Address = a;
            Form f = new Form();
            f.Member = m;
            formValidator.GetInvalidValues(f).Should().Have.Count.EqualTo(1);

            m.Address.City = "my city";
            formValidator.GetInvalidValues(f).Should().Be.Empty();
        }
Exemplo n.º 2
0
        public void TestDeepValid()
        {
            IClassValidator formValidator = GetClassValidator(typeof(Form));

            Address a = new Address();
            Member m = new Member();
            m.Address = a;
            Form f = new Form();
            f.Member = m;
            InvalidValue[] values = formValidator.GetInvalidValues(f);
            Assert.AreEqual(1, values.Length);

            m.Address.City = "my city";
            InvalidValue[] values2 = formValidator.GetInvalidValues(f);
            Assert.AreEqual(0, values2.Length);
        }