Exemplo n.º 1
0
 public void ConvertPreferencesWithtimezoneButNoProjectTimeZone()
 {
     _ = ExportRequestHelper.ConvertToRaptorUserPreferences(new UserPreferenceData
     {
         Timezone = "Aleutian Standard Time"
     },
                                                            null);
 }
Exemplo n.º 2
0
        public void CompactionReportStationOffsetExecutor_Raptor_NoResult()
        {
            var userPreferences = new UserPreferenceData {
                Language = "en-US"
            };
            var request = CompactionReportStationOffsetRequest.CreateRequest(
                33, null, null, 0, null, true, true, true, true, true, true, null, null, 0, 0, 0, null, userPreferences, "New Zealand Standard Time");
            var filterSettings          = RaptorConverters.ConvertFilter(request.Filter);
            var cutfillDesignDescriptor = RaptorConverters.DesignDescriptor(request.DesignFile);
            var alignmentDescriptor     = RaptorConverters.DesignDescriptor(request.AlignmentFile);
            var TASNodeUserPreference   = ExportRequestHelper.ConvertToRaptorUserPreferences(request.UserPreferences, request.ProjectTimezone);

            var options = RaptorConverters.convertOptions(null, request.LiftBuildSettings, 0,
                                                          request.Filter?.LayerType ?? FilterLayerMethod.None, DisplayMode.Height, false);

            var mockConfigStore = new Mock <IConfigurationStore>();

            mockConfigStore.Setup(x => x.GetValueBool("ENABLE_TREX_GATEWAY_STATIONOFFSET")).Returns(false);

            MemoryStream responseData;

            var raptorClient = new Mock <IASNodeClient>();

            var args = ASNode.StationOffsetReport.RPC.__Global.Construct_StationOffsetReport_Args(
                request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                (int)CompactionReportType.StationOffset,
                ASNodeRPC.__Global.Construct_TASNodeRequestDescriptor(Guid.NewGuid(), 0,
                                                                      TASNodeCancellationDescriptorType.cdtProdDataReport),
                TASNodeUserPreference,
                alignmentDescriptor,
                cutfillDesignDescriptor,
                request.StartStation,
                request.EndStation,
                request.Offsets,
                request.CrossSectionInterval,
                request.ReportElevation,
                request.ReportCutFill,
                request.ReportCMV,
                request.ReportMDP,
                request.ReportPassCount,
                request.ReportTemperature,
                (int)GridReportOption.Unused,
                0, 0, 0, 0, 0, 0, 0, // Northings, Eastings and Direction values are not used on Station Offset report.
                filterSettings,
                RaptorConverters.ConvertLift(request.LiftBuildSettings, filterSettings.LayerMethod),
                options
                );

            raptorClient.Setup(x => x.GetReportStationOffset(args, out responseData)).Returns(0); // icsrrUnknownError
            var executor = RequestExecutorContainerFactory
                           .Build <CompactionReportStationOffsetExecutor>(_logger, raptorClient.Object, configStore: mockConfigStore.Object);

            Assert.ThrowsExceptionAsync <ServiceException>(async() => await executor.ProcessAsync(request));
        }
Exemplo n.º 3
0
        private ContractExecutionResult ProcessWithRaptor(CompactionReportStationOffsetRequest request)
        {
            var filterSettings          = RaptorConverters.ConvertFilter(request.Filter, request.ProjectId, raptorClient);
            var cutfillDesignDescriptor = RaptorConverters.DesignDescriptor(request.DesignFile);
            var alignmentDescriptor     = RaptorConverters.DesignDescriptor(request.AlignmentFile);
            var userPreferences         =
                ExportRequestHelper.ConvertToRaptorUserPreferences(request.UserPreferences, request.ProjectTimezone);

            var options = RaptorConverters.convertOptions(null, request.LiftBuildSettings, 0,
                                                          request.Filter?.LayerType ?? FilterLayerMethod.None, DisplayMode.Height, false);

            log.LogDebug($"{nameof(ProcessWithRaptor)}: About to call GetReportStationOffset");

            var args = ASNode.StationOffsetReport.RPC.__Global.Construct_StationOffsetReport_Args(
                request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                (int)CompactionReportType.StationOffset,
                ASNodeRPC.__Global.Construct_TASNodeRequestDescriptor(Guid.NewGuid(), 0,
                                                                      TASNodeCancellationDescriptorType.cdtProdDataReport),
                userPreferences,
                alignmentDescriptor,
                cutfillDesignDescriptor,
                request.StartStation,
                request.EndStation,
                request.Offsets,
                request.CrossSectionInterval,
                request.ReportElevation,
                request.ReportCutFill,
                request.ReportCMV,
                request.ReportMDP,
                request.ReportPassCount,
                request.ReportTemperature,
                (int)GridReportOption.Unused,
                0, 0, 0, 0, 0, 0, 0, // Northings, Eastings and Direction values are not used on Station Offset report.
                filterSettings,
                RaptorConverters.ConvertLift(request.LiftBuildSettings, filterSettings.LayerMethod),
                options
                );

            int raptorResult = raptorClient.GetReportStationOffset(args, out var responseData);

            if (raptorResult == 1) // icsrrNoError
            {
                return(responseData.Length > 0
          ? ConvertStationOffsetResult(request, responseData)
          : CreateNullStationOffsetReturnedResult());
            }

            throw CreateServiceException <CompactionReportStationOffsetExecutor>();
        }
Exemplo n.º 4
0
 public void ConvertEmptyPreferences()
 {
     var converted = ExportRequestHelper.ConvertToRaptorUserPreferences(new UserPreferenceData(), "Aleutian Standard Time");
 }