示例#1
0
        public void CustomComparisons_ShouldMatch()
        {
            var expected = new
            {
                Name      = Expect.NotNull(),
                DateTime  = Expect.Default <DateTime>(),
                Customer  = Expect.Any <Customer>(),
                Customer2 = Expect.Any <Customer>(x => x.FirstName == "foo")
            }.ToExpectedObject();


            var actual = new Receipt
            {
                Name      = "John Doe",
                DateTime  = DateTime.MinValue,
                Customer  = new Customer(),
                Customer2 = new Customer()
                {
                    FirstName = "foo"
                }
            };


            // observation
            expected.ShouldMatch(actual);
        }