public void ProjectStatisticsExecutor_Raptor_Success() { var excludedSurveyedSurfaceUids = new[] { Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid() }; var excludedSurveyedSurfaceIds = new long[] { 444, 777, 888 }; var request = new ProjectStatisticsMultiRequest(Guid.NewGuid(), 123, excludedSurveyedSurfaceUids, excludedSurveyedSurfaceIds); var statistics = new TICDataModelStatistics { StartTime = DateTime.UtcNow.AddDays(-5), EndTime = DateTime.UtcNow.AddDays(-1), CellSize = 32.5, IndexOriginOffset = 10, Extents = new T3DBoundingWorldExtent(10, 500, 0, 20, 510, 0) }; var raptorClient = new Mock <IASNodeClient>(); raptorClient .Setup(x => x.GetDataModelStatistics(request.ProjectId, It.IsAny <TSurveyedSurfaceID[]>(), out statistics)) .Returns(true); var configStore = new Mock <IConfigurationStore>(); configStore.Setup(x => x.GetValueBool("ENABLE_TREX_GATEWAY_PROJECTSTATISTICS")).Returns(false); var executor = RequestExecutorContainerFactory .Build <ProjectStatisticsExecutor>(logger, raptorClient.Object, configStore: configStore.Object); var result = executor.ProcessAsync(request).Result as ProjectStatisticsResult; Assert.IsNotNull(result, "Result should not be null"); Assert.AreEqual(statistics.CellSize, result.cellSize, "Wrong CellSize"); Assert.AreEqual(statistics.Extents.MaxX, result.extents.MaxX, "Wrong MaxX extent"); }
private static ProjectStatisticsResult ConvertProjectStatistics(TICDataModelStatistics statistics) { return(new ProjectStatisticsResult { cellSize = statistics.CellSize, endTime = statistics.EndTime, startTime = statistics.StartTime, indexOriginOffset = statistics.IndexOriginOffset, extents = ConvertExtents(statistics.Extents) }); }
public async Task GetBoundingBoxInvalidProductionDataExtents() { //Production data outside project boundary is invalid var prodDataMinLat = projMinLatRadians - 0.2; var prodDataMinLng = projMinLngRadians - 0.2; var prodDataMaxLat = projMaxLatRadians + 0.2; var prodDataMaxLng = projMaxLngRadians + 0.2; var raptorClient = new Mock <IASNodeClient>(); var statistics = new TICDataModelStatistics(); raptorClient .Setup(x => x.GetDataModelStatistics(project.LegacyProjectId, It.IsAny <TSurveyedSurfaceID[]>(), out statistics)) .Returns(true); var pointList = new TCoordPointList { ReturnCode = TCoordReturnCode.nercNoError, Points = new TCoordContainer { Coords = new[] { new TCoordPoint { X = prodDataMinLng, Y = prodDataMinLat }, new TCoordPoint { X = prodDataMaxLng, Y = prodDataMaxLat } } } }; raptorClient .Setup(x => x.GetGridCoordinates(project.LegacyProjectId, It.IsAny <TWGS84FenceContainer>(), TCoordConversionType.ctNEEtoLLH, out pointList)) .Returns(TCoordReturnCode.nercNoError); var service = new BoundingBoxService(serviceProvider.GetRequiredService <ILoggerFactory>() #if RAPTOR , raptorClient.Object #endif , new Mock <IConfigurationStore>().Object , new Mock <ITRexCompactionDataProxy>().Object, new Mock <IFileImportProxy>().Object ); var bbox = await service.GetBoundingBox(project, null, new[] { TileOverlayType.ProductionData }, null, null, null, null, null); Assert.AreEqual(projMinLatRadians, bbox.minLat); Assert.AreEqual(projMaxLatRadians, bbox.maxLat); Assert.AreEqual(projMinLngRadians, bbox.minLng); Assert.AreEqual(projMaxLngRadians, bbox.maxLng); }
public async Task GetBoundingBoxProjectExtentsWithMode() { var raptorClient = new Mock <IASNodeClient>(); var statistics = new TICDataModelStatistics(); raptorClient .Setup(x => x.GetDataModelStatistics(project.LegacyProjectId, It.IsAny <TSurveyedSurfaceID[]>(), out statistics)) .Returns(false); var service = new BoundingBoxService(serviceProvider.GetRequiredService <ILoggerFactory>() #if RAPTOR , raptorClient.Object #endif , new Mock <IConfigurationStore>().Object , new Mock <ITRexCompactionDataProxy>().Object, new Mock <IFileImportProxy>().Object ); var bbox = await service.GetBoundingBox(project, null, new[] { TileOverlayType.ProductionData, TileOverlayType.ProjectBoundary }, null, null, null, null, null); Assert.AreEqual(projMinLatRadians, bbox.minLat); Assert.AreEqual(projMaxLatRadians, bbox.maxLat); Assert.AreEqual(projMinLngRadians, bbox.minLng); Assert.AreEqual(projMaxLngRadians, bbox.maxLng); }
public bool GetDataModelStatistics(long projectID, TSurveyedSurfaceID[] exclusionList, out TICDataModelStatistics statistics) { //TODO modify shims to provide error status code return(client.GetDataModelStatistics(projectID, exclusionList, out statistics) == 1);/*icsrrNoError*/ }