I have a class called Matrix2D which essentially holds a 2-dimensional integer array. Then I have another class that multiplies 2 matrices. How can I put a unit test together for testing the multiplication function?
[TestClass]
public class UnitTest
{
[TestMethod]
[DataRow(new Matrix2D(new int[,] { { 2, 1, 3 }, { 1, 3, 2 } }), new Matrix2D(new int[,] { { 35, 30 }, { 50, 40 }, { 70, 75 } }), new Matrix2D(new int[,] { { 330, 325 }, { 325, 300 } }))]
public void TestMethod(Matrix2D a, Matrix2D b, Matrix2D c)
{
var program = new MatrixMultiplier();
Assert.AreEqual(c, MatrixMultiplier.Multiplies(a, b));
}
}
It complains about line 5 regardless of what data I put in. I also tried passing in a regular 2d integer array and creating those matrices inside the function, but still keeps complaining. Couldn't find a solution anywhere, so thank you in advance.