public void GivenEngineBeingConstructed_WhenNoInstanceOfIInterpolationStrategyProvided_ThenThrowsAnException() { Assert.Throws <ArgumentNullException>(() => { var interpolationEngine = new InterpolationEngine(null); }); }
public void GivenEngineBeingConstructed_WhenInstanceOfIInterpolationStrategyProvided_ThenDoesNotThrowAnException() { Assert.DoesNotThrow(() => { var interpolationEngine = new InterpolationEngine(Mock.Of <IInterpolationStrategy>()); }); }
public void GivenEngine_WhenInterpolateCalledWithNoTwoDimensionalArrayOfDoubles_ThenThrowAnException() { // Arrange var interpolationEngine = new InterpolationEngine(Mock.Of <IInterpolationStrategy>()); // Act Assert.Throws <ArgumentNullException>(() => interpolationEngine.Interpolate(null)); }
public void GivenEngine_WhenInterpolateCalledWithATwoDimensionalArrayOfDoubles_ThenDoesNotThrowAnException() { // Arrange var interpolationEngine = new InterpolationEngine(Mock.Of <IInterpolationStrategy>()); // Act Assert.DoesNotThrow(() => interpolationEngine.Interpolate(new double[0, 0])); }
public void GivenEngineWithValidStratgey_WhenInterpolateCalledWithValidInput_ThenReturnsExpectedOutput( double[,] input, double[,] expectedInterpolatedMatrix) { // Arrange var interpolationEngine = new InterpolationEngine(new FourNonDiagonalNeighboursNoAdjacentNansStrategy()); // Act var interpolatedMatrix = interpolationEngine.Interpolate(input); // Assert CustomAssertInterpolatedMatrixAsExpected(expectedInterpolatedMatrix, interpolatedMatrix); }
public void GivenEngine_WhenInterpolateCalledWithATwoDimensionalArrayOfDoubles_ThenReturnsATwoDimensionalArrayOfDoubles() { // Arrange var interpolationEngine = new InterpolationEngine(Mock.Of <IInterpolationStrategy>()); // Act var output = interpolationEngine.Interpolate(new double[, ] { }); // Assert Assert.That(output, Is.TypeOf <double[, ]>()); }
static void Main(string[] args) { try { var(inputFile, outputFile) = GetArgumentValues(args); var input = FileOperations.ReadInput(inputFile); var inputMatrix = DataOperations.ConvertAndValidateInput(input); var interpolationEngine = new InterpolationEngine(new FourNonDiagonalNeighboursNoAdjacentNansStrategy()); var interpolatedMatrix = interpolationEngine.Interpolate(inputMatrix); FileOperations.WriteOutput(outputFile, interpolatedMatrix.AsString()); } catch (Exception e) { Display(e.Message); } }