Example #1
0
        public void Test_CMVStatisticsResponse_AgregateWith_Successful()
        {
            var responseClone = new CMVStatisticsResponse()
            {
                ResultStatus            = _response.ResultStatus,
                CellSize                = _response.CellSize,
                CellsScannedOverTarget  = _response.CellsScannedOverTarget,
                CellsScannedAtTarget    = _response.CellsScannedAtTarget,
                CellsScannedUnderTarget = _response.CellsScannedUnderTarget,
                SummaryCellsScanned     = _response.SummaryCellsScanned,
                IsTargetValueConstant   = _response.IsTargetValueConstant,
                LastTargetCMV           = _response.LastTargetCMV,
                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.LastTargetCMV == _response.LastTargetCMV, "Invalid aggregated value for LastTargetCMV.");
            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}].");
            }
        }
Example #2
0
        public void Test_CMVStatisticsResponse_Creation()
        {
            var response = new CMVStatisticsResponse();

            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.LastTargetCMV == 0, "Invalid initial value for LastTargetCMV.");
            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.");
        }
Example #3
0
        public void Test_CMVStatisticsCoordinator_ReadOutResults_Details_Successful()
        {
            var aggregator  = _getCMVAggregator(Arg_Details);
            var coordinator = _getCoordinator();

            var response = new CMVStatisticsResponse();

            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}].");
            }
        }
Example #4
0
        public void Test_CMVStatisticsCoordinator_ReadOutResults_Summary_Successful()
        {
            var aggregator  = _getCMVAggregator(Arg_Summary);
            var coordinator = _getCoordinator();

            var response = new CMVStatisticsResponse();

            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.LastTargetCMV == aggregator.LastTargetCMV, "Invalid read-out value for LastTargetCMV.");
            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.");
        }
Example #5
0
        public void Test_CMVStatisticsResponse()
        {
            var response = new CMVStatisticsResponse()
            {
                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,
                LastTargetCMV      = 500
            };

            SimpleBinarizableInstanceTester.TestClass(response, "Custom CMVStatisticsResponse not same after round trip serialisation");
        }