示例#1
0
        public void WrongTypeInSourceCanBeDiffed()
        {
            var classA = new ClassA(null, "Test");
            var classB = new ClassAWithWrongPropType(10, "Test");

            var diff = classB.DiffObjects(classA);

            Assert.Single(diff);
        }
示例#2
0
        public void WhenPropertyInTargetObjectHasWrongTypeThenExceptionIsRaised()
        {
            var classA = new ClassA(1, "Test");
            var classAWithWrongPropType = new ClassAWithWrongPropType(1, "Test");

            Assert.Throws <InvalidCastException>(() =>
            {
                classA.If().PropertyValuesMatch(classAWithWrongPropType, throwExceptionOnPropertyMismatch: true).ThenReturn(true);
            });
        }
示例#3
0
        public void WhenPropertyInTargetObjectHasWrongTypeThenExceptionIsRaised()
        {
            var classA = new ClassA(1, "Test");
            var classAWithWrongPropType = new ClassAWithWrongPropType(1, "Test");

            Assert.Throws<InvalidCastException>(() =>
            {
                classA.If().PropertyValuesMatch(classAWithWrongPropType).ThenReturn(true);
            });
        }