//=========================================================================================== private static void Test_Values(ConvolveMatrix matrix) { Assert.AreEqual(0.0, matrix.GetValue(0, 0)); Assert.AreEqual(1.0, matrix.GetValue(1, 0)); Assert.AreEqual(2.0, matrix.GetValue(2, 0)); Assert.AreEqual(0.1, matrix.GetValue(0, 1)); Assert.AreEqual(1.1, matrix.GetValue(1, 1)); Assert.AreEqual(2.1, matrix.GetValue(2, 1)); Assert.AreEqual(0.2, matrix.GetValue(0, 2)); Assert.AreEqual(1.2, matrix.GetValue(1, 2)); Assert.AreEqual(2.2, matrix.GetValue(2, 2)); }
public void Test_Constructor() { ExceptionAssert.Throws<ArgumentException>(delegate() { new ConvolveMatrix(-1); }); ExceptionAssert.Throws<ArgumentException>(delegate() { new ConvolveMatrix(6); }); new ConvolveMatrix(1); ExceptionAssert.Throws<ArgumentException>(delegate() { new ConvolveMatrix(2, 1.0); }); ConvolveMatrix matrix = new ConvolveMatrix(3, 0.0, 1.0, 2.0, 0.1, 1.1, 2.1, 0.2, 1.2, 2.2); Test_Values(matrix); ExceptionAssert.Throws<ArgumentException>(delegate() { new ConvolveMatrix(2, null); }); matrix = new ConvolveMatrix(3, new double[] { 0.0, 1.0, 2.0, 0.1, 1.1, 2.1, 0.2, 1.2, 2.2 }); Test_Values(matrix); }