Exemplo n.º 1
0
        public void PropertySet_ValidationOnly_Negative_ActualNotNull()
        {
            var validatedEntity = new ValidationEntityNotNull();
            var messageCheck    = new MessageCheck("Property Set is not valid");

            messageCheck.AddPropertyLine("Not Null", "Null", "Id");
            var ex = Assert.Throws(typeof(AssertionException),
                                   () =>
                                   Assert.That(validatedEntity, Entity.Is.Valid));

            messageCheck.Check(ex);
        }
Exemplo n.º 2
0
        public void PropertySet_ValidationOnly_Negative_ActualGreaterThan()
        {
            var validatedEntity = new ValidationEntityGreaterThan();
            var messageCheck    = new MessageCheck("Property Set is not valid");

            messageCheck.AddPropertyLine("Greater than 5", "0", "Id");
            var ex = Assert.Throws(typeof(AssertionException),
                                   () =>
                                   Assert.That(validatedEntity, Entity.Is.Valid));

            Console.WriteLine(ex.Message);
            messageCheck.Check(ex);
        }
Exemplo n.º 3
0
        public void PropertySet_Compare_RecursiveReference_Negative_ActualNull_Level0()
        {
            var expected = new ObjectWithRecursiveRef {
                IntValue = 1
            };

            expected.RecursiveRef = expected;
            var actual = new ObjectWithRecursiveRef
            {
                IntValue     = 1,
                RecursiveRef = null
            };
            var messageCheck = new MessageCheck("Property Set is not equal");

            messageCheck.AddPropertyLine(typeof(ObjectWithRecursiveRef).FullName, "Null", "RecursiveRef");
            var ex = Assert.Throws(typeof(AssertionException),
                                   () =>
                                   Assert.That(actual, Entity.Is.EqualTo(expected)));

            messageCheck.Check(ex);
        }
Exemplo n.º 4
0
        public void PropertySet_ValidationOnly_Negative_ChildObjects()
        {
            var validatedEntity = new ValidationWithChild
            {
                NotNullProp = new ValidationEntityNotNull {
                    Id = null
                },
                GreaterThanProp = new ValidationEntityGreaterThan {
                    Id = 4
                }
            };
            var messageCheck = new MessageCheck("Property Set is not valid");

            messageCheck.AddPropertyLine("Greater than 5", "4", "GreaterThanProp.Id");
            messageCheck.AddPropertyLine("Not Null", "Null", "NotNullProp.Id");
            var ex = Assert.Throws(typeof(AssertionException),
                                   () =>
                                   Assert.That(validatedEntity, Entity.Is.Valid));

            Console.WriteLine(ex.Message);
            messageCheck.Check(ex);
        }