public async Task ElevationStatisticsExecutor_TRex_NoResult() { var request = new ElevationStatisticsRequest(0, Guid.NewGuid(), null, null, -1, null); var logger = new Mock <ILoggerFactory>(); var mockConfigStore = new Mock <IConfigurationStore>(); #if RAPTOR mockConfigStore.Setup(x => x.GetValueBool("ENABLE_TREX_GATEWAY_ELEVATION")).Returns(true); #endif var trexCompactionDataProxy = new Mock <ITRexCompactionDataProxy>(); var elevationStatisticsRequest = new ElevationDataRequest(request.ProjectUid.Value, request.Filter, null, null); trexCompactionDataProxy.Setup(x => x.SendDataPostRequest <ElevationStatisticsResult, ElevationDataRequest>(elevationStatisticsRequest, It.IsAny <string>(), It.IsAny <IHeaderDictionary>(), false)) .Returns((Task <ElevationStatisticsResult>)null); var executor = RequestExecutorContainerFactory .Build <ElevationStatisticsExecutor>(logger.Object, configStore: mockConfigStore.Object, trexCompactionDataProxy: trexCompactionDataProxy.Object); var result = await executor.ProcessAsync(request); Assert.IsNull(result, "Result should be null"); }
public Task <ContractExecutionResult> PostElevationStatistics([FromBody] ElevationDataRequest elevationStatisticsRequest) { Log.LogInformation($"#In# {nameof(PostElevationStatistics)}: {Request.QueryString}"); try { elevationStatisticsRequest.Validate(); return(WithServiceExceptionTryExecuteAsync(() => RequestExecutorContainer .Build <ElevationStatisticsExecutor>(ConfigStore, LoggerFactory, ServiceExceptionHandler) .ProcessAsync(elevationStatisticsRequest))); } finally { Log.LogInformation($"#Out# {nameof(PostElevationStatistics)}: {Request.QueryString}"); } }
protected override async Task <ContractExecutionResult> ProcessAsyncEx <T>(T item) { var request = CastRequestObjectTo <ElevationStatisticsRequest>(item); #if RAPTOR if (UseTRexGateway("ENABLE_TREX_GATEWAY_ELEVATION") || UseTRexGateway("ENABLE_TREX_GATEWAY_TILES")) { #endif await PairUpAssetIdentifiers(request.ProjectUid.Value, request.Filter); await PairUpImportedFileIdentifiers(request.ProjectUid.Value, filter1 : request.Filter); var elevationStatisticsRequest = new ElevationDataRequest( request.ProjectUid.Value, request.Filter, AutoMapperUtility.Automapper.Map <OverridingTargets>(request.LiftBuildSettings), AutoMapperUtility.Automapper.Map <LiftSettings>(request.LiftBuildSettings)); return(await trexCompactionDataProxy.SendDataPostRequest <ElevationStatisticsResult, ElevationDataRequest>(elevationStatisticsRequest, "/elevationstatistics", customHeaders)); #if RAPTOR } //new TASNodeElevationStatisticsResult(); var Filter = RaptorConverters.ConvertFilter(request.Filter, request.ProjectId, raptorClient); var raptorResult = raptorClient.GetElevationStatistics(request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID, ASNodeRPC.__Global.Construct_TASNodeRequestDescriptor((Guid)(request.CallId ?? Guid.NewGuid()), 0, TASNodeCancellationDescriptorType.cdtElevationStatistics), Filter, RaptorConverters.ConvertLift(request.LiftBuildSettings, TFilterLayerMethod.flmAutomatic), out var result); if (raptorResult == TASNodeErrorStatus.asneOK) { return(ConvertResult(result)); } throw CreateServiceException <ElevationStatisticsExecutor>((int)raptorResult); #endif }