Esempio n. 1
0
        public void Test_MDPAggregator_ProcessResult_WithAggregation_Summary()
        {
            var aggregator = new MDPStatisticsAggregator();

            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.MDP) as ClientMDPLeafSubGrid;

            clientGrid.FillWithTestPattern();

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

            aggregator.CellSize             = TestConsts.CELL_SIZE;
            aggregator.OverrideMachineMDP   = true;
            aggregator.OverridingMachineMDP = (short)(length - 1);
            aggregator.MDPPercentageRange   = new MDPRangePercentageRecord(100, 100);

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

            aggregator.ProcessSubGridResult(subGrids);

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

            otherAggregator.CellSize             = TestConsts.CELL_SIZE;
            otherAggregator.OverrideMachineMDP   = true;
            otherAggregator.OverridingMachineMDP = (short)(length - 1);
            otherAggregator.MDPPercentageRange   = new MDPRangePercentageRecord(100, 100);

            otherAggregator.ProcessSubGridResult(subGrids);

            aggregator.AggregateWith(otherAggregator);

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

            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.MDP) as ClientMDPLeafSubGrid;

            clientGrid.FillWithTestPattern();

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

            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 MDPStatisticsAggregator();

            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}].");
            }
        }