public void GivenAnIInterpolationStrategyInstance_WhenInterpolateCalledWithInvalidIndices_ThenThrowsAnException( uint rowIndex, uint columnIndex, double[,] matrix) { IInterpolationStrategy strategy = new FourNonDiagonalNeighboursNoAdjacentNansStrategy(); Assert.Throws <ArgumentException>(() => strategy.InterpolateValue(rowIndex, columnIndex, matrix)); }
public void GivenAnIInterpolationStrategyInstance_WhenInterpolateCalledWithInvalidIndices_ThenThrowsAnException( uint rowIndex, uint columnIndex, double[,] matrix, double expectedInterpolatedValue) { // Arrange IInterpolationStrategy strategy = new FourNonDiagonalNeighboursNoAdjacentNansStrategy(); // Act double interpolatedValue = strategy.InterpolateValue(rowIndex, columnIndex, matrix); // Assert Assert.That(Math.Abs(interpolatedValue - expectedInterpolatedValue), Is.LessThan(0.000001), () => $"Expected {expectedInterpolatedValue}, Actual {interpolatedValue}"); }
public void GivenAnIInterpolationStrategyInstance_WhenInterpolateCalledWithNullAsMatrix_ThenThrowsAnException() { IInterpolationStrategy strategy = new FourNonDiagonalNeighboursNoAdjacentNansStrategy(); Assert.Throws <ArgumentNullException>(() => strategy.InterpolateValue((uint)0, (uint)0, null)); }
public void GivenAnIInterpolationStrategyInstance_WhenInterpolateCalled_ThenExpectsRowAndColumnIndicesAndTwoDimensionalMatrixOfDoubles() { IInterpolationStrategy strategy = new FourNonDiagonalNeighboursNoAdjacentNansStrategy(); Assert.DoesNotThrow(() => strategy.InterpolateValue((uint)0, (uint)0, new double[1, 1])); }