public void BorderNodesMatrixTest() { // Arrange double a = 0; double b = 1; double c = 0; double d = 1; int n = Convert.ToInt32(TestContext.DataRow["N"]); int m = Convert.ToInt32(TestContext.DataRow["M"]); CoordinateSystemConfig systemConfig = new CoordinateSystemConfig(a, b, c, d, n, m); MatrixBuilder matrixBuilder = new MatrixBuilder(systemConfig, null); NodeBorderValue[] expectedNodeBorderValues = Convert.ToString(TestContext.DataRow["BorderValue"]) .Split() .Select(str => (NodeBorderValue)Enum.Parse(typeof(NodeBorderValue), str)) .ToArray(); // Act NodeBorderValue[] actualNodeBorderValues = matrixBuilder.BorderNodesMatrix; // Assert CollectionAssert.AreEqual(expectedNodeBorderValues, actualNodeBorderValues); }
public void NodesAmountTest() { // Arrange double a = 0; double b = 1; double c = 0; double d = 1; int n = Convert.ToInt32(TestContext.DataRow["N"]); int m = Convert.ToInt32(TestContext.DataRow["M"]); int expectedNodesAmount = Convert.ToInt32(TestContext.DataRow["NodesAmount"]); CoordinateSystemConfig systemConfig = new CoordinateSystemConfig(a, b, c, d, n, m); // Act int actualNodesAmount = systemConfig.NodesAmount; // Assert Assert.AreEqual(expectedNodesAmount, actualNodesAmount); }
public void CoordinateMatrixTest() { // Arrange double a = Convert.ToInt32(TestContext.DataRow["A"]); double b = Convert.ToInt32(TestContext.DataRow["B"]); double c = Convert.ToInt32(TestContext.DataRow["C"]); double d = Convert.ToInt32(TestContext.DataRow["D"]); int n = Convert.ToInt32(TestContext.DataRow["N"]); int m = Convert.ToInt32(TestContext.DataRow["M"]); CoordinateSystemConfig systemConfig = new CoordinateSystemConfig(a, b, c, d, n, m); MatrixBuilder matrixBuilder = new MatrixBuilder(systemConfig, null); int rows = Convert.ToInt32(TestContext.DataRow["Rows"]); double[][] expectedCoordinateMatrix = new double[rows][]; IEnumerable <double> values = Convert.ToString(TestContext.DataRow["Values"]) .Split(new char[] { ' ', '|' }, StringSplitOptions.RemoveEmptyEntries) .Select(double.Parse); for (int i = 0; i < rows; ++i) { expectedCoordinateMatrix[i] = values.Skip(i * 2).Take(2).ToArray(); } // Act Matrix actualCoordinateMatrix = matrixBuilder.CoordinateMatrix; // Assert for (int i = 0; i < rows; ++i) { CollectionAssert.AreEqual(expectedCoordinateMatrix[i], actualCoordinateMatrix.Data[i]); } }