Пример #1
0
 public void GivenEngineBeingConstructed_WhenNoInstanceOfIInterpolationStrategyProvided_ThenThrowsAnException()
 {
     Assert.Throws <ArgumentNullException>(() =>
     {
         var interpolationEngine = new InterpolationEngine(null);
     });
 }
Пример #2
0
 public void GivenEngineBeingConstructed_WhenInstanceOfIInterpolationStrategyProvided_ThenDoesNotThrowAnException()
 {
     Assert.DoesNotThrow(() =>
     {
         var interpolationEngine = new InterpolationEngine(Mock.Of <IInterpolationStrategy>());
     });
 }
Пример #3
0
        public void GivenEngine_WhenInterpolateCalledWithNoTwoDimensionalArrayOfDoubles_ThenThrowAnException()
        {
            // Arrange
            var interpolationEngine = new InterpolationEngine(Mock.Of <IInterpolationStrategy>());

            // Act
            Assert.Throws <ArgumentNullException>(() => interpolationEngine.Interpolate(null));
        }
Пример #4
0
        public void GivenEngine_WhenInterpolateCalledWithATwoDimensionalArrayOfDoubles_ThenDoesNotThrowAnException()
        {
            // Arrange
            var interpolationEngine = new InterpolationEngine(Mock.Of <IInterpolationStrategy>());

            // Act
            Assert.DoesNotThrow(() => interpolationEngine.Interpolate(new double[0, 0]));
        }
Пример #5
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);
        }
Пример #6
0
        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[, ]>());
        }
Пример #7
0
        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);
            }
        }