public void PropertySet_ChildList_ItemDifference()
        {
            var expected = new TestObjectWithChildList {
                Child = new List <TestObject> {
                    new TestObject {
                        Value = "value"
                    }
                }
            };
            var actual = new TestObjectWithChildList
            {
                Child = new List <TestObject> {
                    new TestObject {
                        Value = "different"
                    }
                }
            };
            var messageCheck = new MessageCheck("Property Set is not equal");

            messageCheck.AddPropertyLine("value", "different", "Child[0].Value");
            var ex = Assert.Throws(typeof(AssertionException),
                                   () => Assert.That(actual, Entity.Is.EqualTo(expected)));

            messageCheck.Check(ex);
        }
        public void PropertySet_ChildList()
        {
            var expected = new TestObjectWithChildList
            {
                Child = new List <TestObject> {
                    new TestObject {
                        Value = "value1"
                    }, new TestObject {
                        Value = "value2"
                    }
                }
            };
            var actual = new TestObjectWithChildList
            {
                Child = new List <TestObject> {
                    new TestObject {
                        Value = "value1"
                    }, new TestObject {
                        Value = "value2"
                    }
                }
            };

            Assert.That(actual, Entity.Is.EqualTo(expected));
        }
        public void PropertySet_ChildList_ExpectingNullList_ActualNull()
        {
            var expected = new TestObjectWithChildList {
                Child = null
            };
            var actual = new TestObjectWithChildList {
                Child = null
            };

            Assert.That(actual, Entity.Is.EqualTo(expected));
        }
        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);
        }
        public void PropertySet_ChildList_ExpectingLessThanActual()
        {
            var expected = new TestObjectWithChildList {
                Child = new List <TestObject> {
                    new TestObject()
                }
            };
            var actual = new TestObjectWithChildList {
                Child = new List <TestObject> {
                    new TestObject(), new TestObject()
                }
            };
            var messageCheck = new MessageCheck("Property Set is not equal");

            messageCheck.AddPropertyLine("1", "2", "Child.Count");
            var ex = Assert.Throws(typeof(AssertionFailedException),
                                   () => Assert.That(actual, Entity.EqualTo(expected)));

            messageCheck.Check(ex);
        }
        public void PropertySet_ChildList_ExpectingMoreThanActual()
        {
            var expected = new TestObjectWithChildList
            {
                Child = new List <TestObject> {
                    new TestObject(), new TestObject()
                }
            };
            var actual = new TestObjectWithChildList {
                Child = new List <TestObject> {
                    new TestObject()
                }
            };
            var messageCheck = new MessageCheck("Property Set is not equal");

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

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