Exemple #1
0
        public void Success()
        {
            var expected = new DeepClass {
                Shallow = new ShallowClass {
                    Value1 = 42, Value2 = "Hello, world!"
                }, Value3 = 21.12m
            };
            var actual = new DeepClass2 {
                Shallow = new ShallowClass {
                    Value1 = 42, Value2 = "Hello, world!"
                }, Value3 = 21.12m
            };

            Assert.Equivalent(expected, actual);
        }
Exemple #2
0
        public void Failure()
        {
            var expected = new DeepClass {
                Shallow = new ShallowClass {
                    Value1 = 42, Value2 = "Hello, world!"
                }, Value3 = 21.12m
            };
            var actual = new DeepClass2 {
                Shallow = new ShallowClass {
                    Value1 = 2600, Value2 = "Hello, world!"
                }, Value3 = 21.12m
            };

            var ex = Record.Exception(() => Assert.Equivalent(expected, actual));

            Assert.IsType <EquivalentException>(ex);
            Assert.Equal(
                "Assert.Equivalent() Failure: Mismatched value on member 'Shallow.Value1'" + Environment.NewLine +
                "Expected: 42" + Environment.NewLine +
                "Actual:   2600",
                ex.Message
                );
        }