Esempio n. 1
0
        public void PropertySet_ChildSet_ExpectedChildPropertyNotNull_ActualNull()
        {
            var expected = new TestObjectWithChildSet
            {
                ValidationProperty = "value",
                Child = new TestObjectWithChildSet {
                    ValidationProperty = "cildvalue"
                }
            };
            var actual = new TestObjectWithChildSet
            {
                ValidationProperty = "value",
                Child = new TestObjectWithChildSet {
                    ValidationProperty = null
                }
            };
            var messageCheck = new MessageCheck("Property Set is not equal");

            messageCheck.AddObjectLine("cildvalue", "Null", "Child.ValidationProperty");
            var ex = Assert.Throws(typeof(AssertionException),
                                   () => Assert.That(actual, Entity.Is.EqualTo(expected)));

            Console.WriteLine(ex.Message);
            messageCheck.Check(ex);
        }
Esempio n. 2
0
        public void PropertySet_ExpectingNotNullObject_ActualNull()
        {
            var expected = new TestObjectCustomValidation {
                CustomValidation = "Validation"
            };
            TestObjectCustomValidation actual = null;
            var messageCheck = new MessageCheck("Property Set is not equal");

            messageCheck.AddObjectLine(typeof(TestObjectCustomValidation).ToString(), "Null");
            var ex = Assert.Throws(typeof(AssertionException),
                                   () => Assert.That(actual, Entity.Is.EqualTo(expected)));

            Console.WriteLine(ex.Message);
            messageCheck.Check(ex);
        }
Esempio n. 3
0
        public void PropertySet_ChildList_ExpectingNotNullList_ActualNull()
        {
            var expected = new TestObjectWithChildList {
                Child = new List <TestObject> {
                    new TestObject()
                }
            };
            var actual = new TestObjectWithChildList {
                Child = null
            };
            var messageCheck = new MessageCheck("Property Set is not equal");

            messageCheck.AddObjectLine(typeof(List <TestObject>).ToString(), "Null", "Child");

            var ex = Assert.Throws(typeof(AssertionException),
                                   () => Assert.That(actual, Entity.Is.EqualTo(expected)));

            Console.WriteLine(ex.Message);
            messageCheck.Check(ex);
        }
Esempio n. 4
0
        public void PropertySet_ChildList_ExpectingMoreThanActual_ItemsMatch_Contains()
        {
            var expected = new EntityWithChildListContains
            {
                Child = new List <TestObject> {
                    new TestObject(), new TestObject()
                }
            };
            var actual = new EntityWithChildListContains {
                Child = new List <TestObject> {
                    new TestObject()
                }
            };
            var messageCheck = new MessageCheck("Property Set is not equal");

            messageCheck.AddPropertyLine("Greater or equal to 2", "1", "Child.Count");
            messageCheck.AddObjectLine(typeof(TestObject).ToString(), "Null", "Child[1]");
            var ex = Assert.Throws(typeof(AssertionException),
                                   () => Assert.That(actual, Entity.Is.EqualTo(expected)));

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