Exemplo n.º 1
0
        public void TestEqualsAdditionEgales()
        {
            Addition op = new Addition(12, 3);

            Assert.IsTrue(op.Equals(new Addition(11, 4)));
            Assert.IsTrue(op.Equals(op));
        }
Exemplo n.º 2
0
        public static void CanEquateBinaryOperations()
        {
            var op1 = new Addition(Numbers.One, Numbers.Two);
            var op2 = new Addition(Numbers.One, Numbers.Two);

            Assert.True(op1.Equals(op2));
            Assert.True(op1.Equals(op1));
            // repeat for memoization test
            Assert.True(op1.Equals(op2));
            Assert.True(op2.Equals(op1));
        }
Exemplo n.º 3
0
        public void TestEqualsNull()
        {
            Addition op  = new Addition(12, 4);
            Object   obj = null;;

            Assert.IsFalse(op.Equals(obj));
        }
Exemplo n.º 4
0
        public static void BinaryOperationsCanCompareToUnaryOperations()
        {
            var op1 = new Addition(Numbers.One, Numbers.One);
            var op2 = new Negation(Numbers.Two);

            Assert.False(op1 == op2);
            Assert.False(op2 == op1);
            Assert.False(op1.Equals(op2));
            Assert.False(op2.Equals(op1));
        }
Exemplo n.º 5
0
        public void TestEqualsAdditionNonEgales()
        {
            Addition op = new Addition(12, 3);

            Assert.IsFalse(op.Equals(new Addition(10, 2)));
        }
Exemplo n.º 6
0
        public void TestEqualsNonAddition()
        {
            Addition op = new Addition(12, 4);

            Assert.IsFalse(op.Equals(new Exception()));
        }