public void Test_CMVChangeStatisticsResponse_AgregateWith_Successful() { var responseClone = new CMVChangeStatisticsResponse() { ResultStatus = _response.ResultStatus, CellSize = _response.CellSize, CellsScannedOverTarget = _response.CellsScannedOverTarget, CellsScannedAtTarget = _response.CellsScannedAtTarget, CellsScannedUnderTarget = _response.CellsScannedUnderTarget, SummaryCellsScanned = _response.SummaryCellsScanned, IsTargetValueConstant = _response.IsTargetValueConstant, Counts = _response.Counts.ToArray() }; var response = _response.AggregateWith(responseClone); Assert.True(Math.Abs(response.CellSize - _response.CellSize) < Consts.TOLERANCE_DIMENSION, "CellSize invalid after aggregation."); Assert.True(response.SummaryCellsScanned == _response.SummaryCellsScanned * 2, "Invalid aggregated value for SummaryCellsScanned."); Assert.True(Math.Abs(response.SummaryProcessedArea - _response.SummaryProcessedArea * 2) < Consts.TOLERANCE_DIMENSION, "Invalid aggregated value for SummaryProcessedArea."); Assert.True(response.Counts.Length == responseClone.Counts.Length, "Invalid value for Counts."); for (int i = 0; i < response.Counts.Length; i++) { Assert.True(response.Counts[i] > responseClone.Counts[i], $"Invalid aggregated value for Counts[{i}]."); } }
public void Test_CMVChangeStatisticsResponse_Creation() { var response = new CMVChangeStatisticsResponse(); Assert.True(response.ResultStatus == RequestErrorStatus.Unknown, "ResultStatus invalid after creation."); Assert.True(response.CellSize < Consts.TOLERANCE_DIMENSION, "CellSize invalid after creation."); Assert.True(response.SummaryCellsScanned == 0, "Invalid initial value for SummaryCellsScanned."); Assert.True(response.CellsScannedOverTarget == 0, "Invalid initial value for CellsScannedOverTarget."); Assert.True(response.CellsScannedAtTarget == 0, "Invalid initial value for CellsScannedAtTarget."); Assert.True(response.CellsScannedUnderTarget == 0, "Invalid initial value for CellsScannedUnderTarget."); Assert.True(response.IsTargetValueConstant, "Invalid initial value for IsTargetValueConstant."); Assert.True(!response.MissingTargetValue, "Invalid initial value for MissingTargetValue."); Assert.True(response.Counts == null, "Invalid initial value for Counts."); }
public void Test_CMVChangeStatisticsResponse() { var response = new CMVChangeStatisticsResponse() { ResultStatus = RequestErrorStatus.OK, CellSize = TestConsts.CELL_SIZE, CellsScannedOverTarget = TestConsts.CELLS_OVER_TARGET, CellsScannedAtTarget = TestConsts.CELLS_AT_TARGET, CellsScannedUnderTarget = TestConsts.CELLS_UNDER_TARGET, SummaryCellsScanned = TestConsts.CELLS_OVER_TARGET + TestConsts.CELLS_AT_TARGET + TestConsts.CELLS_UNDER_TARGET, IsTargetValueConstant = true, Counts = TestConsts.CountsArray, MissingTargetValue = false }; SimpleBinarizableInstanceTester.TestClass(response, "Custom CMVChangeStatisticsResponse not same after round trip serialisation"); }
public void Test_CMVChangeStatisticsCoordinator_ReadOutResults_Successful() { var aggregator = _getCMVAggregator(); var coordinator = _getCoordinator(); var response = new CMVChangeStatisticsResponse(); coordinator.ReadOutResults(aggregator, response); Assert.True(Math.Abs(response.CellSize - aggregator.CellSize) < Consts.TOLERANCE_DIMENSION, "CellSize invalid after result read-out."); Assert.True(Math.Abs(response.SummaryProcessedArea - aggregator.SummaryProcessedArea) < Consts.TOLERANCE_DIMENSION, "Invalid read-out value for SummaryProcessedArea."); Assert.True(response.Counts.Length == aggregator.Counts.Length, "Invalid read-out value for Counts.Length."); for (int i = 0; i < response.Counts.Length; i++) { Assert.True(response.Counts[i] == aggregator.Counts[i], $"Invalid aggregated value for Counts[{i}]."); } }