Exemple #1
0
        public void Test_ElevationAggregator_ProcessResult_WithAggregation()
        {
            var aggregator = new ElevationStatisticsAggregator();

            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.Height) as ClientHeightLeafSubGrid;

            clientGrid.FillWithTestPattern();

            var dLength = clientGrid.Cells.Length;

            aggregator.CellSize = TestConsts.CELL_SIZE;

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

            aggregator.ProcessSubGridResult(subGrids);

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

            otherAggregator.CellSize = TestConsts.CELL_SIZE;

            otherAggregator.ProcessSubGridResult(subGrids);

            aggregator.AggregateWith(otherAggregator);

            Assert.True(aggregator.CellsScanned == dLength * 2, "Invalid value for CellsScanned.");
            Assert.True(aggregator.CellsUsed == dLength * 2, "Invalid value for CellsUsed.");
            Assert.True(Math.Abs(aggregator.CoverageArea - 2 * dLength * Math.Pow(aggregator.CellSize, 2)) < Consts.TOLERANCE_AREA, "Invalid value for CoverageArea.");
            Assert.True(Math.Abs(aggregator.MinElevation) < Consts.TOLERANCE_HEIGHT, "Invalid value for MinElevation.");
            Assert.True(Math.Abs(aggregator.MaxElevation - MAX_ELEVATION) < Consts.TOLERANCE_HEIGHT, "Invalid value for MaxElevation.");
        }
Exemple #2
0
        public void Test_NullCell()
        {
            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.Temperature) as ClientTemperatureLeafSubGrid;

            clientGrid.Cells[0, 0] = clientGrid.NullCell();
            Assert.False(clientGrid.CellHasValue(0, 0), "Cell not set to correct null value");
        }
Exemple #3
0
        private ProgressiveVolumesCalculationsAggregator BuildFilterToFilterAggregatorWithOneAggregation(float baseLevel, float topLevel)
        {
            var subGrids = new[]
            {
                new[] { ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.ProgressiveVolumes) }
            };

            if (!(subGrids[0][0] is ClientProgressiveHeightsLeafSubGrid progressiveSubGrid))
            {
                throw new ArgumentException("Sub grid not a ClientProgressiveHeightsLeafSubGrid");
            }

            progressiveSubGrid.NumberOfHeightLayers = 2;

            TRex.SubGridTrees.Core.Utilities.SubGridUtilities.SubGridDimensionalIterator((x, y) => progressiveSubGrid.Heights[0][x, y] = baseLevel);
            TRex.SubGridTrees.Core.Utilities.SubGridUtilities.SubGridDimensionalIterator((x, y) => progressiveSubGrid.Heights[1][x, y] = topLevel);

            var aggr = new ProgressiveVolumesCalculationsAggregator
            {
                VolumeType        = VolumeComputationType.Between2Filters,
                AggregationStates = new[] { new ProgressiveVolumeAggregationState(SubGridTreeConsts.DefaultCellSize) }
            };

            aggr.ProcessSubGridResult(subGrids);

            return(aggr);
        }
Exemple #4
0
        public void Test_NullCell()
        {
            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.MachineSpeedTarget) as ClientMachineTargetSpeedLeafSubGrid;

            clientGrid.Cells[0, 0] = clientGrid.NullCell();
            Assert.False(clientGrid.CellHasValue(0, 0), "Cell not set to correct null value");
        }
Exemple #5
0
        public void Test_CCAAggregator_ProcessResult_WithAggregation()
        {
            var aggregator = new CCAStatisticsAggregator();

            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.CCA) as ClientCCALeafSubGrid;

            clientGrid.FillWithTestPattern();

            var dLength = clientGrid.Cells.Length;

            aggregator.CellSize = TestConsts.CELL_SIZE;

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

            aggregator.ProcessSubGridResult(subGrids);

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

            otherAggregator.CellSize = TestConsts.CELL_SIZE;


            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 == dLength * 2, "Invalid value for CellsScannedAtTarget.");
            Assert.True(aggregator.CellsScannedOverTarget == 0, "Invalid value for CellsScannedOverTarget.");
            Assert.True(aggregator.CellsScannedUnderTarget == 0, "Invalid value for CellsScannedUnderTarget.");
        }
Exemple #6
0
        public void Test_GenericClientLeafSubgrid_CellHasValue_True_Ex(GridDataType gridDataType)
        {
            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(gridDataType);

            clientGrid.FillWithTestPattern();
            clientGrid.ForEach((x, y) => Assert.True(clientGrid.CellHasValue(x, y), "Cell does not have value when it should"));
        }
Exemple #7
0
        public void BuildLiftsForSinglePassCell_CMVPercentChange(float[] heights, short[] cmvs)
        {
            var siteModel = DITAGFileAndSubGridRequestsWithIgniteFixture.NewEmptyModel();
            var baseTime  = DateTime.UtcNow;

            var cellPasses = new[]
            {
                new CellPass
                {
                    Time   = baseTime,
                    Height = heights[0],
                    CCV    = cmvs[0]
                },
                new CellPass
                {
                    Time   = baseTime.AddHours(1),
                    Height = heights[1],
                    CCV    = cmvs[1]
                },
                new CellPass
                {
                    Time   = baseTime.AddHours(2),
                    Height = heights[2],
                    CCV    = cmvs[2]
                },
                new CellPass
                {
                    Time   = baseTime.AddHours(3),
                    Height = heights[3],
                    CCV    = cmvs[3]
                }
            };

            DITAGFileAndSubGridRequestsFixture.AddSingleCellWithPasses
                (siteModel, SubGridTreeConsts.DefaultIndexOriginOffset, SubGridTreeConsts.DefaultIndexOriginOffset, cellPasses);

            IClientLeafSubGrid clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.CCVPercentChange) as ClientCMVLeafSubGrid;

            var serverGrid = TRex.SubGridTrees.Server.Utilities.SubGridUtilities.LocateSubGridContaining(
                siteModel.PrimaryStorageProxy, siteModel.Grid,
                SubGridTreeConsts.DefaultIndexOriginOffset, SubGridTreeConsts.DefaultIndexOriginOffset,
                siteModel.Grid.NumLevels, false, false) as IServerLeafSubGrid;

            var builder = new CellLiftBuilder(siteModel, GridDataType.CCVPercentChange, new FilteredValuePopulationControl(),
                                              new FilterSet(new CombinedFilter()), new CellPassFastEventLookerUpper(siteModel));

            var cell = new ProfileCell();

            var segmentIterator  = new SubGridSegmentIterator(serverGrid, serverGrid.Directory, siteModel.PrimaryStorageProxy);
            var cellPassIterator = new SubGridSegmentCellPassIterator_NonStatic(segmentIterator);

            var filteredValueAssignmentContext = new FilteredValueAssignmentContext();

            builder.Build(cell, new LiftParameters(), clientGrid, filteredValueAssignmentContext, cellPassIterator, true).Should().BeTrue();

            cell.Layers.Count().Should().Be(1);
            cell.Layers[0].PassCount.Should().Be(4);
            filteredValueAssignmentContext.FilteredValue.FilteredPassData.FilteredPass.CCV.Should().Be(cmvs[cmvs.Length - 1]);
            filteredValueAssignmentContext.PreviousFilteredValue.FilteredPassData.FilteredPass.CCV.Should().Be(cmvs[cmvs.Length - 2]);
        }
Exemple #8
0
        private static void DependencyInjection()
        {
            DIBuilder
            .New()
            .AddLogging()
            .Add(x => x.AddSingleton <ITRexGridFactory>(new TRexGridFactory()))
            .Add(x => x.AddSingleton <IStorageProxyFactory>(new StorageProxyFactory()))
            .Add(x => x.AddTransient <ISurveyedSurfaces>(factory => new SurveyedSurfaces()))
            .Add(x => x.AddSingleton <ISurveyedSurfaceFactory>(new SurveyedSurfaceFactory()))
            .Build()

            // The renderer factory that allows tile rendering services access Bitmap etc platform dependent constructs
            .Add(x => x.AddSingleton <IRenderingFactory>(new RenderingFactory()))

            .Add(x => x.AddSingleton <ISiteModels>(new SiteModels(() => DIContext.Obtain <IStorageProxyFactory>().ImmutableGridStorage())))
            .Add(x => x.AddSingleton <ISiteModelFactory>(new SiteModelFactory()))
            .Add(x => x.AddSingleton <ICoordinateConversion>(new CoordinateConversion()))
            .Add(x => x.AddSingleton <IExistenceMaps>(new VSS.TRex.ExistenceMaps.ExistenceMaps()))
            .Add(x => x.AddSingleton <IPipelineProcessorFactory>(new PipelineProcessorFactory()))
            .Add(x => x.AddSingleton <Func <PipelineProcessorPipelineStyle, ISubGridPipelineBase> >(provider => SubGridPipelineFactoryMethod))
            .Add(x => x.AddTransient <IRequestAnalyser>(factory => new RequestAnalyser()))
            .Add(x => x.AddSingleton <Func <PipelineProcessorTaskStyle, ITask> >(provider => SubGridTaskFactoryMethod))
            .Add(x => x.AddSingleton <IClientLeafSubGridFactory>(ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory()))

            .Add(x => x.AddSingleton(new ApplicationServiceServer(new[] {
                ApplicationServiceServer.DEFAULT_ROLE,
                ServerRoles.ASNODE_PROFILER,
                ServerRoles.PATCH_REQUEST_ROLE,
                ServerRoles.TILE_RENDERING_NODE,
                ServerRoles.ANALYTICS_NODE
            })))

            .Complete();
        }
Exemple #9
0
        private static void DependencyInjection()
        {
            DIBuilder
            .New()
            .AddLogging()

            .Add(x => x.AddSingleton <ITRexGridFactory>(new TRexGridFactory()))
            .Add(x => x.AddSingleton <IStorageProxyFactory>(new StorageProxyFactory()))
            .Add(x => x.AddTransient <ISurveyedSurfaces>(factory => new SurveyedSurfaces()))
            .Add(x => x.AddSingleton <ISurveyedSurfaceFactory>(new SurveyedSurfaceFactory()))
            .Build()
            .Add(x => x.AddSingleton <ISiteModels>(new SiteModels(() => DIContext.Obtain <IStorageProxyFactory>().ImmutableGridStorage())))
            .Add(x => x.AddSingleton <ISiteModelFactory>(new SiteModelFactory()))
            .Add(x => x.AddSingleton <IProfilerBuilderFactory>(new ProfilerBuilderFactory()))
            .Add(x => x.AddTransient <IProfilerBuilder>(factory => new ProfilerBuilder()))
            .Add(x => x.AddSingleton <IExistenceMaps>(new ExistenceMaps()))
            .Add(x => x.AddSingleton <IPipelineProcessorFactory>(new PipelineProcessorFactory()))
            .Add(x => x.AddSingleton <Func <PipelineProcessorPipelineStyle, ISubGridPipelineBase> >(provider => SubGridPipelineFactoryMethod))
            .Add(x => x.AddTransient <IRequestAnalyser>(factory => new RequestAnalyser()))
            .Add(x => x.AddSingleton <Func <PipelineProcessorTaskStyle, ITask> >(provider => SubGridTaskFactoryMethod))
            .Add(x => x.AddSingleton <IProductionEventsFactory>(new ProductionEventsFactory()))
            .Add(x => x.AddSingleton <IClientLeafSubGridFactory>(ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory()))
            .Add(x => x.AddSingleton(new SubGridProcessingServer()))
            .Add(x => x.AddSingleton <IDesignsService>(new DesignsService(StorageMutability.Immutable)))
            .Complete();
        }
Exemple #10
0
        public void Test_NullCell()
        {
            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.CompositeHeights) as ClientCompositeHeightsLeafSubgrid;

            clientGrid.Cells[0, 0] = clientGrid.NullCell();
            Assert.False(clientGrid.CellHasValue(0, 0), "Cell not set to correct null value");
        }
Exemple #11
0
        public void SupportsCorrectAssignableTypes()
        {
            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.Height) as ClientHeightLeafSubGrid;

            clientGrid.SupportsAssignationFrom(GridDataType.Height).Should().BeTrue();
            clientGrid.SupportsAssignationFrom(GridDataType.HeightAndTime).Should().BeTrue();
        }
Exemple #12
0
        public void Test_MDPAggregator_ProcessResult_NoAggregation_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);

            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] > 0, $"Invalid value for Counts[{i}].");
            }
        }
Exemple #13
0
        public void Test_SpeedAggregator_ProcessResult_WithAggregation()
        {
            var aggregator = new SpeedStatisticsAggregator();

            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.MachineSpeedTarget) as ClientMachineTargetSpeedLeafSubGrid;

            clientGrid.FillWithTestPattern();

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

            aggregator.CellSize           = TestConsts.CELL_SIZE;
            aggregator.TargetMachineSpeed = new MachineSpeedExtendedRecord((ushort)(length - 1), (ushort)(length - 1));

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

            aggregator.ProcessSubGridResult(subGrids);

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

            otherAggregator.CellSize           = TestConsts.CELL_SIZE;
            otherAggregator.TargetMachineSpeed = new MachineSpeedExtendedRecord((ushort)(length - 1), (ushort)(length - 1));

            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 == dLength - length, "Invalid value for CellsScannedOverTarget.");
            Assert.True(aggregator.CellsScannedUnderTarget == dLength - length, "Invalid value for CellsScannedUnderTarget.");
        }
Exemple #14
0
        public void Test_MDPAggregator_ProcessResult_NoAggregation_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);

            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.");
        }
Exemple #15
0
        public void Test_TemperatureAggregator_ProcessResult_NoAggregation()
        {
            var aggregator = new TemperatureStatisticsAggregator();

            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.Temperature) as ClientTemperatureLeafSubGrid;

            clientGrid.FillWithTestPattern();

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

            aggregator.CellSize = TestConsts.CELL_SIZE;
            aggregator.OverrideTemperatureWarningLevels   = true;
            aggregator.OverridingTemperatureWarningLevels = new TemperatureWarningLevelsRecord((ushort)(length - 1), (ushort)(length - 1));

            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.");
        }
Exemple #16
0
        public void Test_NullCells()
        {
            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.HeightAndTime) as ClientHeightAndTimeLeafSubGrid;

            SubGridUtilities.SubGridDimensionalIterator((x, y) => Assert.True(clientGrid.Cells[x, y] == Consts.NullHeight, "Cell not set to correct null value"));
            SubGridUtilities.SubGridDimensionalIterator((x, y) => Assert.True(clientGrid.Times[x, y] == 0, "Cell time not set to correct null value"));
        }
Exemple #17
0
        public void Test_GenericClientLeafSubgrid_ForEach_Ex(GridDataType gridDataType)
        {
            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(gridDataType);

            int Count = 0;

            clientGrid.ForEach((x, y) => Count++);
            Assert.True(SubGridTreeConsts.SubGridTreeCellsPerSubGrid == Count, "ForEach did not iterate all cells");
        }
Exemple #18
0
        public void Test_IndicativeSize()
        {
            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.MachineSpeed) as ClientMachineSpeedLeafSubGrid;

            int expectedSize = 2 * (4 * 32); // 2 bit mask subgrids in this and parent class
            int actualSize   = clientGrid.IndicativeSizeInBytes();

            Assert.True(actualSize == expectedSize, $"IndicativeSize() incorrect, = {clientGrid.IndicativeSizeInBytes()}, expected = {expectedSize}");
        }
Exemple #19
0
        public void AssignFilteredValue_NoCellProfile_FailWithException()
        {
            var context    = new FilteredValueAssignmentContext();
            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.CellPasses) as ClientCellProfileAllPassesLeafSubgrid;

            Action act = () => clientGrid.AssignFilteredValue(0, 0, context);

            act.Should().Throw <TRexSubGridProcessingException>().WithMessage("*CellProfile not assigned*");
        }
Exemple #20
0
        public void Test_GenericClientLeafSubgrid_Read_FailWithCorruptData(GridDataType gridDataType)
        {
            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(gridDataType);

            byte[] bytes = new byte[100]; // 100 zeros, which will cause the FromBytes call to fail with a TRexSubGridIOException on the grid data type
            Action act   = () => clientGrid.FromBytes(bytes);

            act.Should().Throw <TRexSubGridIOException>().WithMessage("GridDataType in stream does not match GridDataType of local sub grid instance");
        }
Exemple #21
0
        public void Test_NullCells()
        {
            var cell = new ClientCellProfileAllPassesLeafSubgridRecord();

            cell.Clear();

            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.CellPasses) as ClientCellProfileAllPassesLeafSubgrid;

            SubGridUtilities.SubGridDimensionalIterator((x, y) => Assert.True(clientGrid.Cells[x, y].GetHashCode() == cell.GetHashCode()));
        }
Exemple #22
0
        public void Test_NullCells()
        {
            var cell = new MachineSpeedExtendedRecord();

            cell.Clear();

            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.MachineSpeedTarget) as ClientMachineTargetSpeedLeafSubGrid;

            SubGridUtilities.SubGridDimensionalIterator((x, y) => Assert.True(clientGrid.Cells[x, y].Equals(cell)));
        }
Exemple #23
0
        public void Test_NullCells()
        {
            var cell = new SubGridCellPassDataPassCountEntryRecord();

            cell.Clear();

            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.PassCount) as ClientPassCountLeafSubGrid;

            SubGridUtilities.SubGridDimensionalIterator((x, y) => Assert.True(clientGrid.Cells[x, y].Equals(cell)));
        }
Exemple #24
0
        public void Test_NullCells()
        {
            var cell = new SubGridCellCompositeHeightsRecord();

            cell.Clear();

            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.CompositeHeights) as ClientCompositeHeightsLeafSubgrid;

            SubGridUtilities.SubGridDimensionalIterator((x, y) => Assert.True(clientGrid.Cells[x, y].Equals(cell)));
        }
Exemple #25
0
        public void Test_GenericClientLeafSubgrid_Implements_AssignFromCachedPreProcessedClientSubgrid_PartialMap(GridDataType gridDataType)
        {
            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(gridDataType);

            clientGrid.FillWithTestPattern();

            var clientGrid2 = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(gridDataType);

            var filterMap = new SubGridTreeBitmapSubGridBits(SubGridBitsCreationOptions.Unfilled)
            {
Exemple #26
0
        public void Test_HeightClientLeafSubGridTests_AssignableFilteredValueIsNull_False()
        {
            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.Height) as ClientHeightLeafSubGrid;
            var passData   = new FilteredPassData {
                FilteredPass = new CellPass {
                    Height = 42.0f
                }
            };

            Assert.False(clientGrid.AssignableFilteredValueIsNull(ref passData), "Filtered value stated as null when it is not");
        }
Exemple #27
0
        public void RetrieveSubGrid_FailWithSubGridNotFound()
        {
            var siteModel = DITAGFileAndSubGridRequestsWithIgniteFixture.NewEmptyModel();
            var retriever = MakeANewRetriever(siteModel);

            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.ProgressiveVolumes);

            var result = retriever.RetrieveSubGrid(clientGrid, SubGridTreeBitmapSubGridBits.FullMask, out var sieveFilterInUse, null);

            result.Should().Be(ServerRequestResult.SubGridNotFound);
            sieveFilterInUse.Should().BeFalse();
        }
Exemple #28
0
        public void ProcessSubGridResult_FailWothNoDefinedVolumeType()
        {
            var subGrids = new[] { new[] { ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.ProgressiveVolumes) } };

            var aggr = new ProgressiveVolumesCalculationsAggregator();

            aggr.AggregationStates = new ProgressiveVolumeAggregationState[1];

            Action act = () => aggr.ProcessSubGridResult(subGrids);

            act.Should().Throw <ArgumentException>().WithMessage("Unsupported volume type*");
        }
Exemple #29
0
        public void Test_GenericClientLeafSubgrid_Implements_AssignFromCachedPreProcessedClientSubgrid_FullMap(GridDataType gridDataType)
        {
            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(gridDataType);

            clientGrid.FillWithTestPattern();

            var clientGrid2 = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(gridDataType);

            clientGrid2.AssignFromCachedPreProcessedClientSubGrid(clientGrid, new SubGridTreeBitmapSubGridBits(SubGridBitsCreationOptions.Filled));

            clientGrid.Should().BeEquivalentTo(clientGrid2);
        }
Exemple #30
0
        public void Test_GenericClientLeafSubgrid_Creation_EX(GridDataType gridDataType, bool expected)
        {
            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(gridDataType);

            if (expected)
            {
                Assert.NotNull(clientGrid);
            }
            else
            {
                Assert.Null(clientGrid);
            }
        }