public void Test_PassCountSummaryResponse_AgregateWith_Successful() { var responseClone = new PassCountStatisticsResponse() { ResultStatus = _response.ResultStatus, CellSize = _response.CellSize, CellsScannedOverTarget = _response.CellsScannedOverTarget, CellsScannedAtTarget = _response.CellsScannedAtTarget, CellsScannedUnderTarget = _response.CellsScannedUnderTarget, SummaryCellsScanned = _response.SummaryCellsScanned, IsTargetValueConstant = _response.IsTargetValueConstant, LastPassCountTargetRange = _response.LastPassCountTargetRange, Counts = _response.Counts }; 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(response.LastPassCountTargetRange.Min == _response.LastPassCountTargetRange.Min, "Invalid aggregated value for LastPassCountTargetRange.Min."); Assert.True(response.LastPassCountTargetRange.Max == _response.LastPassCountTargetRange.Max, "Invalid aggregated value for LastPassCountTargetRange.Max."); Assert.True(response.CellsScannedOverTarget == _response.CellsScannedOverTarget * 2, "Invalid aggregated value for CellsScannedOverTarget."); Assert.True(response.CellsScannedAtTarget == _response.CellsScannedAtTarget * 2, "Invalid aggregated value for CellsScannedAtTarget."); Assert.True(response.CellsScannedUnderTarget == _response.CellsScannedUnderTarget * 2, "Invalid aggregated value for CellsScannedUnderTarget."); Assert.True(response.IsTargetValueConstant == _response.IsTargetValueConstant, "Invalid aggregated value for IsTargetValueConstant."); Assert.True(response.MissingTargetValue == _response.MissingTargetValue, "Invalid aggregated value for MissingTargetValue."); Assert.True(response.Counts.Length == _response.Counts.Length, "Invalid value for Counts."); for (int i = 0; i < response.Counts.Length; i++) Assert.True(response.Counts[i] > _response.Counts[i], $"Invalid aggregated value for Counts[{i}]."); }
public void Test_PassCountSummaryResponse_Creation() { var response = new PassCountStatisticsResponse(); 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.LastPassCountTargetRange.Min == 0, "Invalid initial value for LastPassCountTargetRange.Min."); Assert.True(response.LastPassCountTargetRange.Max == 0, "Invalid initial value for LastPassCountTargetRange.Max."); 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_PassCountStatisticsCoordinator_ReadOutResults_Details_Successful() { var aggregator = _getPassCountAggregator(Arg_Details); var coordinator = _getCoordinator(); var response = new PassCountStatisticsResponse(); coordinator.ReadOutResults(aggregator, response); Assert.True(Math.Abs(response.CellSize - aggregator.CellSize) < Consts.TOLERANCE_DIMENSION, "CellSize invalid after result read-out."); 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}]."); } }
public void Test_PassCountStatisticsResponse() { var response = new PassCountStatisticsResponse() { 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, LastPassCountTargetRange = new PassCountRangeRecord(2, 9) }; SimpleBinarizableInstanceTester.TestClass(response, "Custom PassCountStatisticsResponse not same after round trip serialisation"); }
public void Test_PassCountStatisticsCoordinator_ReadOutResults_Sumary_Successful() { var aggregator = _getPassCountAggregator(Arg_Summary); var coordinator = _getCoordinator(); var response = new PassCountStatisticsResponse(); coordinator.ReadOutResults(aggregator, response); Assert.True(Math.Abs(response.CellSize - aggregator.CellSize) < Consts.TOLERANCE_DIMENSION, "CellSize invalid after result read-out."); Assert.True(response.SummaryCellsScanned == aggregator.SummaryCellsScanned, "Invalid read-out value for SummaryCellsScanned."); Assert.True(response.LastPassCountTargetRange.Min == aggregator.LastPassCountTargetRange.Min, "Invalid read-out value for LastPassCountTargetRange.Min."); Assert.True(response.LastPassCountTargetRange.Max == aggregator.LastPassCountTargetRange.Max, "Invalid read-out value for LastPassCountTargetRange.Max."); Assert.True(response.CellsScannedOverTarget == aggregator.CellsScannedOverTarget, "Invalid read-out value for CellsScannedOverTarget."); Assert.True(response.CellsScannedAtTarget == aggregator.CellsScannedAtTarget, "Invalid read-out value for CellsScannedAtTarget."); Assert.True(response.CellsScannedUnderTarget == aggregator.CellsScannedUnderTarget, "Invalid read-out value for CellsScannedUnderTarget."); Assert.True(response.IsTargetValueConstant == aggregator.IsTargetValueConstant, "Invalid read-out value for IsTargetValueConstant."); Assert.True(response.MissingTargetValue == aggregator.MissingTargetValue, "Invalid initial read-out for MissingTargetValue."); }