Exemplo n.º 1
0
        public void CanAssertEqualityFailBasedOnLocalDefinedObjectAndOnlyAssertNonDefaultFields()
        {
            var toTest = new FieldTest
            {
                Id        = 7,
                Name      = "Foobar",
                Age       = 42,
                Locations = new List <string>
                {
                    "Europe",
                    "Asia"
                }
            };

            var expected = new FieldTest
            {
                Name = "Fooba"
            };

            var e = Assert.Throws <VerificationException>(() => toTest.Verify(() => expected));

            Assert.Equal(nameof(PropertyTest.Name), e.Target);
            Assert.Equal("Fooba", e.ExpectedValue);
            Assert.Equal("Foobar", e.ActualValue);
        }
Exemplo n.º 2
0
        public void CanAssertEqualityBasedOnLocalDefinedObjectAndOnlyAssertNonDefaultFields()
        {
            var toTest = new FieldTest
            {
                Id        = 7,
                Name      = "Foobar",
                Age       = 42,
                Locations = new List <string>
                {
                    "Europe",
                    "Asia"
                }
            };

            var expected = new FieldTest
            {
                Name = "Foobar"
            };

            toTest.Verify(() => expected);
        }