public void TestMultiplyMultiple() { var vector1 = new MathVector(new List <double>() { 1, 2, 4, 0 }); var vector2 = new MathVector(new List <double>() { 4, 5, 2, 1 }); var assumedVector = new MathVector(new List <double>() { 4, 10, 8, 0 }); var resultVector1 = (MathVector)vector1.Multiply(vector2); var resultVector2 = (MathVector)vector2.Multiply(vector1); Assert.IsTrue(assumedVector.Equals(resultVector1)); Assert.IsTrue(resultVector1.Equals(resultVector2)); }
public void TestMultiplyEmpty() { var vector1 = new MathVector(new List <double>()); var vector2 = new MathVector(new List <double>()); var assumedVector = new MathVector(new List <double>()); var resultVector1 = (MathVector)vector1.Multiply(vector2); var resultVector2 = (MathVector)vector2.Multiply(vector1); Assert.IsTrue(assumedVector.Equals(resultVector1)); Assert.IsTrue(resultVector1.Equals(resultVector2)); }
public void TestMultiplyArithmeticException() { var vector1 = new MathVector(new List <double>() { 1, 2, 4, 0 }); var vector2 = new MathVector(new List <double>() { 1, 1 }); Assert.ThrowsException <ArithmeticException>(() => vector1.Multiply(vector2)); Assert.ThrowsException <ArithmeticException>(() => vector2.Multiply(vector1)); }