示例#1
0
            public void Parameterized_custom_matcher_without_render_expressions_and_different_arguments()
            {
                var first  = GetMatch(() => Order.IsSmallerThan(123M));
                var second = GetMatch(() => Order.IsSmallerThan(456M));

                Assert.NotEqual(first, second);
            }
示例#2
0
            public void Different_parameterized_custom_matchers_without_render_expressions_but_equal_arguments()
            {
                var first  = GetMatch(() => Order.IsSmallerThan(123M));
                var second = GetMatch(() => Order.IsLargerThan(123M));

                Assert.NotEqual(first, second);
            }
示例#3
0
            public void Parameterized_custom_matcher_without_render_expression_but_equal_arguments()
            {
                // This is almost guaranteed to trip someone up sooner or later, as the reason why
                // below two matchers aren't equal is not obvious at first glance.
                //
                // If a parameterized custom matcher only provides a predicate (delegate) but no
                // render expression, how do we get at the parameters in order to compare them?
                // Short answer: They typically sit on the delegate's target object, which we'd have
                // to compare for structural equality. Which is is kind of expensive.
                //
                // So for the moment, this ambiguity is left unresolved. If you run into this, the
                // easiest way to work around it is to provide a render expression to `Match.Create`.

                var first  = GetMatch(() => Order.IsSmallerThan(123M));
                var second = GetMatch(() => Order.IsSmallerThan(123M));

                Assert.NotEqual(first, second);
            }