public void LanczosResamplingAlgorithmComputeTest() { LanczosResamplingAlgorithm algorithm = new LanczosResamplingAlgorithm(_rasterMock.Object); for (Double rowIndex = 0; rowIndex < _rasterMock.Object.NumberOfRows; rowIndex += 0.41) { for (Double columnIndex = 0; columnIndex < _rasterMock.Object.NumberOfColumns; columnIndex += 0.41) { Int32 rowFloor = (Int32)Math.Floor(rowIndex); Int32 columnFloor = (Int32)Math.Floor(columnIndex); for (Int32 bandIndex = 0; bandIndex < _rasterMock.Object.NumberOfBands; bandIndex++) { Double minValue = Double.MaxValue, maxValue = Double.MinValue; for (Int32 i = rowFloor - algorithm.Radius + 1; i <= rowFloor + algorithm.Radius; i++) { for (Int32 j = columnFloor - algorithm.Radius + 1; j <= columnFloor + algorithm.Radius; j++) { UInt32 value = _rasterMock.Object.GetBoxedValue(i, j, bandIndex); minValue = Math.Min(minValue, value); maxValue = Math.Max(maxValue, value); } } Double strategyValue = algorithm.Compute(rowIndex, columnIndex, bandIndex); Assert.GreaterOrEqual(strategyValue, minValue); Assert.LessOrEqual(strategyValue, maxValue); } } } }
public void LanczosResamplingAlgorithmConstructorTest() { LanczosResamplingAlgorithm algorithm = new LanczosResamplingAlgorithm(_rasterMock.Object); Assert.AreEqual(3, algorithm.Radius); algorithm = new LanczosResamplingAlgorithm(_rasterMock.Object, 5); Assert.AreEqual(5, algorithm.Radius); Assert.Throws <ArgumentNullException>(() => algorithm = new LanczosResamplingAlgorithm(null)); Assert.Throws <ArgumentOutOfRangeException>(() => algorithm = new LanczosResamplingAlgorithm(_rasterMock.Object, 0)); }