public void Multiply_Follows_The_Properties_Of_Multiplication() { // Arrange var calc = new Calculator(); // Act var itMultiplies = calc.Multiply(3, 5) == 15 && calc.Multiply(-1, -3) == 3 && calc.Multiply(2, -1) == -2; var conmutative = calc.Multiply(3, 2) == calc.Multiply(2, 3); var associative = calc.Multiply(1, calc.Multiply(2, 3)) == calc.Multiply(calc.Multiply(1, 2), 3); var multiplicativeIdentitity = calc.Multiply(3, 1) == 3; var distributiveSum = calc.Multiply(2, calc.Sum(1, 3)) == calc.Sum(calc.Multiply(2, 1), calc.Multiply(2, 3)); var distributiveSubstraction = calc.Multiply(2, calc.Substract(1, 3)) == calc.Substract(calc.Multiply(2, 1), calc.Multiply(2, 3)); //Assert Assert.IsTrue(itMultiplies, "Multiplication"); Assert.IsTrue(conmutative, "Conmutative"); Assert.IsTrue(associative, "Associative"); Assert.IsTrue(multiplicativeIdentitity, "Multiplicative identity"); Assert.IsTrue(distributiveSum, "Distributive sum"); Assert.IsTrue(distributiveSubstraction, "Distributive substraction"); }
public void Sum_Follows_The_Properties_Of_Addition() { // Arrange var calc = new Calculator(); // Act var itSums = calc.Sum(3, 5) == 8 && calc.Sum(-1, -3) == -4; var conmutative = calc.Sum(1, 2) == calc.Sum(2, 1); var associative = calc.Sum(1, calc.Sum(2, 3)) == calc.Sum(calc.Sum(1, 2), 3); var additiveIdentitity = calc.Sum(1, 0) == 1; var distributive = calc.Multiply(2, calc.Sum(1, 3)) == calc.Sum(calc.Multiply(2, 1), calc.Multiply(2, 3)); //Assert Assert.IsTrue(itSums, "Addition"); Assert.IsTrue(conmutative, "Conmutative"); Assert.IsTrue(associative, "Associative"); Assert.IsTrue(additiveIdentitity, "Additive identity"); Assert.IsTrue(distributive, "Distributive"); }