コード例 #1
0
            public void Test()
            {
                var stub1 = new NonComparableStub(123);
                var stub2 = new NonComparableStub(456);

                Assert.GreaterThan(stub2, stub1);
                Assert.LessThan(stub1, stub2);
            }
コード例 #2
0
        public void Compares_with_a_custom_comparer(int value1, int value2, int expectedSign)
        {
            var a = new NonComparableStub(value1);
            var b = new NonComparableStub(value2);

            extensionPoints.CustomComparers.Register <NonComparableStub>((x, y) => x.Value.CompareTo(y.Value));
            int actualSign = comparisonSemantics.Compare(a, b);

            Assert.AreEqual(expectedSign, actualSign, (x, y) => Math.Sign(x) == Math.Sign(y));
            extensionPoints.CustomComparers.Unregister <NonComparableStub>();
        }
コード例 #3
0
        public void Equals_with_a_custom_comparer(int value1, int value2, bool expectedEqual)
        {
            var a = new NonComparableStub(value1);
            var b = new NonComparableStub(value2);

            extensionPoints.CustomEqualityComparers.Register <NonComparableStub>((x, y) => x.Value == y.Value);
            bool actualEqual = comparisonSemantics.Equals(a, b);

            Assert.AreEqual(expectedEqual, actualEqual);
            extensionPoints.CustomEqualityComparers.Unregister <NonComparableStub>();
        }
コード例 #4
0
 public void Test()
 {
     var stub1 = new NonComparableStub(123);
     var stub2 = new NonComparableStub(456);
     Assert.GreaterThan(stub2, stub1);
     Assert.LessThan(stub1, stub2);
 }