Beispiel #1
0
        public void Test_CMVStatisticsAggregator_ProcessResult_WithAggregation_Details()
        {
            var aggregator = new CMVChangeStatisticsAggregator();

            var clientGrid = new ClientCMVLeafSubGrid();

            clientGrid.FillWithTestPattern();

            aggregator.CellSize = TestConsts.CELL_SIZE;
            aggregator.CMVChangeDetailsDataValues = new[] { -100.0, 0.0, 100.0 };
            aggregator.Counts = new long[aggregator.CMVChangeDetailsDataValues.Length];

            IClientLeafSubGrid[][] subGrids = new[] { new[] { clientGrid } };

            aggregator.ProcessSubGridResult(subGrids);

            // Other aggregator...
            var otherAggregator = new CMVChangeStatisticsAggregator();

            otherAggregator.CellSize = TestConsts.CELL_SIZE;
            otherAggregator.CMVChangeDetailsDataValues = new[] { -100.0, 0.0, 100.0 };
            otherAggregator.Counts = new long[aggregator.CMVChangeDetailsDataValues.Length];

            otherAggregator.ProcessSubGridResult(subGrids);

            aggregator.AggregateWith(otherAggregator);

            Assert.True(aggregator.Counts.Length == aggregator.CMVChangeDetailsDataValues.Length, "Invalid value for DetailsDataValues.");
            for (int i = 0; i < aggregator.Counts.Length; i++)
            {
                Assert.True(aggregator.Counts[i] == otherAggregator.Counts[i] * 2, $"Invalid aggregated value for Counts[{i}].");
            }

            Assert.True(aggregator.Counts.Sum() == aggregator.SummaryCellsScanned, "Invalid value for total number of processed cells.");
        }
Beispiel #2
0
        public void Test_CMVStatisticsAggregator_ProcessResult_NoAggregation_Summary()
        {
            var aggregator = new CMVStatisticsAggregator();
            var clientGrid = new ClientCMVLeafSubGrid();

            clientGrid.FillWithTestPattern();

            var dLength = clientGrid.Cells.Length;
            var length  = (short)Math.Sqrt(dLength);

            aggregator.CellSize             = TestConsts.CELL_SIZE;
            aggregator.OverrideMachineCMV   = true;
            aggregator.OverridingMachineCMV = (short)(length - 1);
            aggregator.CMVPercentageRange   = new CMVRangePercentageRecord(100, 100);

            IClientLeafSubGrid[][] subGrids = new[] { new[] { clientGrid } };

            aggregator.ProcessSubGridResult(subGrids);

            Assert.True(aggregator.SummaryCellsScanned == dLength, "Invalid value for SummaryCellsScanned.");
            Assert.True(Math.Abs(aggregator.SummaryProcessedArea - dLength * Math.Pow(aggregator.CellSize, 2)) < Consts.TOLERANCE_DIMENSION, "Invalid value for SummaryProcessedArea.");
            Assert.True(aggregator.CellsScannedAtTarget == length, "Invalid value for CellsScannedAtTarget.");
            Assert.True(aggregator.CellsScannedOverTarget == 0, "Invalid value for CellsScannedOverTarget.");
            Assert.True(aggregator.CellsScannedUnderTarget == dLength - length, "Invalid value for CellsScannedUnderTarget.");
        }
Beispiel #3
0
        public void Test_CMVStatisticsAggregator_ProcessResult_WithAggregation_Details()
        {
            var aggregator = new CMVStatisticsAggregator();

            var clientGrid = new ClientCMVLeafSubGrid();

            clientGrid.FillWithTestPattern();

            aggregator.CellSize          = TestConsts.CELL_SIZE;
            aggregator.DetailsDataValues = new[] { 1, 5, 10, 15, 20, 25, 31 };
            aggregator.Counts            = new long[aggregator.DetailsDataValues.Length];

            IClientLeafSubGrid[][] subGrids = new[] { new[] { clientGrid } };

            aggregator.ProcessSubGridResult(subGrids);

            // Other aggregator...
            var otherAggregator = new CMVStatisticsAggregator();

            otherAggregator.CellSize          = TestConsts.CELL_SIZE;
            otherAggregator.DetailsDataValues = new[] { 1, 5, 10, 15, 20, 25, 31 };
            otherAggregator.Counts            = new long[aggregator.DetailsDataValues.Length];

            otherAggregator.ProcessSubGridResult(subGrids);

            aggregator.AggregateWith(otherAggregator);

            Assert.True(aggregator.Counts.Length == aggregator.DetailsDataValues.Length, "Invalid value for DetailsDataValues.");
            for (int i = 0; i < aggregator.Counts.Length; i++)
            {
                Assert.True(aggregator.Counts[i] == otherAggregator.Counts[i] * 2, $"Invalid aggregated value for Counts[{i}].");
            }
        }
Beispiel #4
0
        public void Test_PatchRequestResponse()
        {
            var response = new PatchRequestResponse()
            {
                ResultStatus = RequestErrorStatus.OK,
                TotalNumberOfPagesToCoverFilteredData = 1000,
                SubGrids = new List <IClientLeafSubGrid>()
            };

            var cmvSubGrid = new ClientCMVLeafSubGrid();

            cmvSubGrid.FillWithTestPattern();
            response.SubGrids.Add(cmvSubGrid);

            var passCountSubGrid = new ClientPassCountLeafSubGrid();

            passCountSubGrid.FillWithTestPattern();
            response.SubGrids.Add(passCountSubGrid);

            var mdpSubGrid = new ClientMDPLeafSubGrid();

            mdpSubGrid.FillWithTestPattern();
            response.SubGrids.Add(mdpSubGrid);


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