コード例 #1
0
        public void PropertySet_ByInterface_Failure()
        {
            var object1 = new TestObjectByInterface1
            {
                ChildList =
                    new List <TestObjectWithChildSet>
                {
                    new TestObjectWithChildSet
                    {
                        Child = new TestObjectWithChildSet {
                            ValidationProperty = "valueExp"
                        }
                    }
                },
                CustomValidation = "ValidationPropertyC",
                Object1Value     = "Object1Value",
                Value1           = "Value1"
            };

            var object2 = new TestObjectByInterface2
            {
                ChildList =
                    new List <TestObjectWithChildSet>
                {
                    new TestObjectWithChildSet
                    {
                        Child = new TestObjectWithChildSet {
                            ValidationProperty = "value"
                        }
                    }
                },
                CustomValidation = "ValidationProperty",
                Object1Value     = "Object2Value",
                Value1           = "Value1",
                Object2Value     = "Value2"
            };
            var messageCheck = new MessageCheck("Property Set is not equal");

            messageCheck.AddPropertyLine("valueExp", "value", "ChildList[0].Child.ValidationProperty");
            messageCheck.AddPropertyLine("ValidationPropertyCCustom", "ValidationProperty", "CustomValidation");
            var ex = Assert.Throws(typeof(AssertionFailedException),
                                   () =>
                                   Assert.That(object2, Entity.EqualTo(object1).ByInterface(typeof(ITestObject))));

            messageCheck.Check(ex);
        }
コード例 #2
0
        public void PropertySet_ByInterface()
        {
            var object1 = new TestObjectByInterface1
            {
                ChildList =
                    new List <TestObjectWithChildSet>
                {
                    new TestObjectWithChildSet
                    {
                        Child = new TestObjectWithChildSet {
                            ValidationProperty = "value"
                        }
                    }
                },
                CustomValidation = "ValidationProperty",
                Object1Value     = "Object1Value",
                Value1           = "Value1"
            };

            var object2 = new TestObjectByInterface2
            {
                ChildList =
                    new List <TestObjectWithChildSet>
                {
                    new TestObjectWithChildSet
                    {
                        Child = new TestObjectWithChildSet {
                            ValidationProperty = "value"
                        }
                    }
                },
                CustomValidation = "ValidationPropertyCustom",
                Object1Value     = "Object2Value",
                Value1           = "Value1",
                Object2Value     = "Value2"
            };

            Assert.That(object2, Entity.EqualTo(object1).ByInterface(typeof(ITestObject)));
        }