예제 #1
0
        public void PropertiesAreDifferent()
        {
            var expected = new TestClass()
            {
                IntegerPropery = 1, StringPropery = "Test"
            };
            var actual = new TestClass2()
            {
                IntegerPropery = 999, SecondIntegerProperty = 2, StringPropery = expected.StringPropery
            };

            var constraintToTest = new EquivalentPropertyWiseToConstraint(expected);
            var result           = constraintToTest.ApplyTo(actual);

            Assert.That(result, NUnit.Framework.Is.Not.Null);
            Assert.That(result.IsSuccess, NUnit.Framework.Is.False);
            Assert.That(result.Description, NUnit.Framework.Is.EqualTo("property IntegerPropery value to be 1"));
        }
예제 #2
0
        public void PropertyDoesNotExistOnActual()
        {
            var expected = new TestClass2()
            {
                IntegerPropery = 1, SecondIntegerProperty = 2, StringPropery = "Test"
            };
            var actual = new TestClass()
            {
                IntegerPropery = expected.IntegerPropery, StringPropery = expected.StringPropery
            };

            var constraintToTest = new EquivalentPropertyWiseToConstraint(expected);
            var result           = constraintToTest.ApplyTo(actual);

            Assert.That(result, NUnit.Framework.Is.Not.Null);
            Assert.That(result.IsSuccess, NUnit.Framework.Is.False);
            Assert.That(result.Description, NUnit.Framework.Is.EqualTo("expected property SecondIntegerProperty does not exist."));
        }