Exemplo n.º 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.");
        }
Exemplo n.º 2
0
        public void Test_CMVStatisticsAggregator_Creation()
        {
            var aggregator = new CMVChangeStatisticsAggregator();

            Assert.True(aggregator.SiteModelID == Guid.Empty, "Invalid initial value for SiteModelID.");
            Assert.True(aggregator.CellSize < Consts.TOLERANCE_DIMENSION, "Invalid initial value for CellSize.");
            Assert.True(aggregator.SummaryCellsScanned == 0, "Invalid initial value for SummaryCellsScanned.");
            Assert.True(aggregator.CellsScannedOverTarget == 0, "Invalid initial value for CellsScannedOverTarget.");
            Assert.True(aggregator.CellsScannedAtTarget == 0, "Invalid initial value for CellsScannedAtTarget.");
            Assert.True(aggregator.CellsScannedUnderTarget == 0, "Invalid initial value for CellsScannedUnderTarget.");
            Assert.True(aggregator.IsTargetValueConstant, "Invalid initial value for IsTargetValueConstant.");
            Assert.True(!aggregator.MissingTargetValue, "Invalid initial value for MissingTargetValue.");

            Assert.True(aggregator.CMVChangeDetailsDataValues == null, "Invalid initial value for DetailsDataValues.");
            Assert.True(aggregator.Counts == null, "Invalid initial value for Counts.");
        }