public void ShouldSerializeCMV_returns_correct_result_When_CMV_is_set(bool reportCmv, short cmv, bool expectedResult) { var request = CompactionReportGridRequest.CreateCompactionReportGridRequest(0, null, null, 0, null, false, reportCmv, false, false, false, false, null, null, GridReportOption.Unused, 0, 0, 0, 0, 0); #if RAPTOR var row = GridRow.CreateRow(new TGridRow { CMV = cmv }, request); #else var row = GridRow.CreateRow(new GriddedReportDataRowBase { Cmv = cmv }, request); #endif Assert.AreEqual(expectedResult, row.ShouldSerializeCMV()); }
public void ShouldSerializeTemperature_returns_correct_result_When_Temperature_is_set(bool reportTemperature, short temperature, bool expectedResult) { var request = CompactionReportGridRequest.CreateCompactionReportGridRequest(0, null, null, 0, null, false, false, false, false, reportTemperature, false, null, null, GridReportOption.Unused, 0, 0, 0, 0, 0); #if RAPTOR var row = GridRow.CreateRow(new TGridRow { Temperature = temperature }, request); #else var row = GridRow.CreateRow(new GriddedReportDataRowBase { Temperature = temperature }, request); #endif Assert.AreEqual(expectedResult, row.ShouldSerializeTemperature()); }
public void Temperature_returns_original_value_divided_by_10(short temperature, double expectedResult) { var request = CompactionReportGridRequest.CreateCompactionReportGridRequest(0, null, null, 0, null, false, false, false, true, false, false, null, null, GridReportOption.Unused, 0, 0, 0, 0, 0); #if RAPTOR var row = GridRow.CreateRow(new TGridRow { Temperature = temperature }, request); #else var row = GridRow.CreateRow(new GriddedReportDataRowBase { Temperature = temperature }, request); #endif Assert.AreEqual(expectedResult, row.Temperature); }
public void ShouldSerializePassCount_returns_correct_result_When_PassCount_is_set(bool reportPasscount, short passCount, bool expectedResult) { var request = CompactionReportGridRequest.CreateCompactionReportGridRequest(0, null, null, 0, null, false, false, false, reportPasscount, false, false, null, null, GridReportOption.Unused, 0, 0, 0, 0, 0); #if RAPTOR var row = GridRow.CreateRow(new TGridRow { PassCount = passCount }, request); #else var row = GridRow.CreateRow(new GriddedReportDataRowBase { PassCount = passCount }, request); #endif Assert.AreEqual(expectedResult, row.ShouldSerializePassCount()); }
public async Task CompactionReportGridExecutorSuccess() { var request = CompactionReportGridRequest.CreateCompactionReportGridRequest( 0, null, null, -1, null, false, false, false, false, false, false, null, 0.0, GridReportOption.Automatic, 0.0, 0.0, 0.0, 0.0, 0.0); MemoryStream responseData = new MemoryStream(); var raptorClient = new Mock <IASNodeClient>(); var args = ASNode.GridReport.RPC.__Global.Construct_GridReport_Args( request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID, (int)CompactionReportType.Grid, It.IsAny <TASNodeRequestDescriptor>(), It.IsAny <TVLPDDesignDescriptor>(), request.GridInterval, request.ReportElevation, request.ReportCutFill, request.ReportCMV, request.ReportMDP, request.ReportPassCount, request.ReportTemperature, (int)request.GridReportOption, request.StartNorthing, request.StartEasting, request.EndNorthing, request.EndEasting, request.Azimuth, It.IsAny <TICFilterSettings>(), It.IsAny <TICLiftBuildSettings>(), It.IsAny <TSVOICOptions>() ); raptorClient. Setup(x => x.GetReportGrid(args, out responseData)). Returns(1); // icsrrNoError var executor = RequestExecutorContainerFactory .Build <CompactionReportGridExecutor>(_logger, raptorClient.Object); var result = await executor.ProcessAsync(request) as CompactionReportResult; Assert.IsNotNull(result, "Result should not be null"); var reportDataAsJson = JsonConvert.SerializeObject(result.ReportData); Assert.AreEqual(responseData.ToString(), reportDataAsJson, "Wrong Data"); }
public void CompactionReportGridExecutor_Raptor_NoResult() { var request = CompactionReportGridRequest.CreateCompactionReportGridRequest( 0, null, null, -1, null, false, false, false, false, false, false, null, 0.0, GridReportOption.Automatic, 0.0, 0.0, 0.0, 0.0, 0.0); 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.GridReport.RPC.__Global.Construct_GridReport_Args( request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID, (int)CompactionReportType.Grid, It.IsAny <TASNodeRequestDescriptor>(), It.IsAny <TVLPDDesignDescriptor>(), request.GridInterval, request.ReportElevation, request.ReportCutFill, request.ReportCMV, request.ReportMDP, request.ReportPassCount, request.ReportTemperature, (int)request.GridReportOption, request.StartNorthing, request.StartEasting, request.EndNorthing, request.EndEasting, request.Azimuth, It.IsAny <TICFilterSettings>(), It.IsAny <TICLiftBuildSettings>(), It.IsAny <TSVOICOptions>() ); raptorClient. Setup(x => x.GetReportGrid(args, out responseData)). Returns(0); // icsrrUnknownError var executor = RequestExecutorContainerFactory .Build <CompactionReportGridExecutor>(_logger, raptorClient.Object, configStore: mockConfigStore.Object); Assert.ThrowsExceptionAsync <ServiceException>(async() => await executor.ProcessAsync(request)); }
public void ValidateCompactionReportGridRequestTest() { // GridReportOption - Automatic CompactionReportGridRequest request = CompactionReportGridRequest.CreateCompactionReportGridRequest( 1, null, null, -1, null, true, true, true, true, true, false, null, 1.0, GridReportOption.Automatic, 0.0, 0.0, 0.0, 0.0, 0.0); request.Validate(); // GridReportOption - Manual (Second/End Point) request = CompactionReportGridRequest.CreateCompactionReportGridRequest( 1, null, null, -1, null, true, true, true, true, true, false, null, 1.0, GridReportOption.EndPoint, 1230.0, 2827.0, 12350.0, 28340.0, 0.0); request.Validate(); // GridReportOption - Manual (Direction/Azimuth) request = CompactionReportGridRequest.CreateCompactionReportGridRequest( 1, null, null, -1, null, true, true, true, true, true, false, null, 1.0, GridReportOption.Direction, 0.0, 0.0, 0.0, 0.0, Math.PI); request.Validate(); }
private ContractExecutionResult ProcessWithRaptor(CompactionReportGridRequest request) { var raptorFilter = RaptorConverters.ConvertFilter(request.Filter, request.ProjectId, raptorClient); var options = RaptorConverters.convertOptions(null, request.LiftBuildSettings, 0, request.Filter?.LayerType ?? FilterLayerMethod.None, DisplayMode.Height, false); log.LogDebug($"{nameof(ProcessWithRaptor)}: About to call GetReportGrid"); var args = ASNode.GridReport.RPC.__Global.Construct_GridReport_Args( request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID, (int)CompactionReportType.Grid, ASNodeRPC.__Global.Construct_TASNodeRequestDescriptor(Guid.NewGuid(), 0, TASNodeCancellationDescriptorType.cdtProdDataReport), RaptorConverters.DesignDescriptor(request.DesignFile), request.GridInterval, request.ReportElevation, request.ReportCutFill, request.ReportCMV, request.ReportMDP, request.ReportPassCount, request.ReportTemperature, (int)request.GridReportOption, request.StartNorthing, request.StartEasting, request.EndNorthing, request.EndEasting, request.Azimuth, raptorFilter, RaptorConverters.ConvertLift(request.LiftBuildSettings, raptorFilter.LayerMethod), options ); int raptorResult = raptorClient.GetReportGrid(args, out var responseData); if (raptorResult == 1) // icsrrNoError { return(responseData.Length > 0 ? ConvertGridResult(request, responseData) : CreateNullGridReturnedResult()); } throw CreateServiceException <CompactionReportGridExecutor>(); }
public void CanCreateCompactionReportGridRequestTest() { var validator = new DataAnnotationsValidator(); ICollection <ValidationResult> results; // GridReportOption - Automatic CompactionReportGridRequest request = CompactionReportGridRequest.CreateCompactionReportGridRequest( 1, null, null, -1, null, true, true, true, true, true, false, null, 1.0, GridReportOption.Automatic, 0.0, 0.0, 0.0, 0.0, 0.0); Assert.IsTrue(validator.TryValidate(request, out results)); // GridReportOption - Manual (Second/End Point) request = CompactionReportGridRequest.CreateCompactionReportGridRequest( 1, null, null, -1, null, true, true, true, true, true, false, null, 1.0, GridReportOption.EndPoint, 1230.0, 2827.0, 12350.0, 28340.0, 0.0); Assert.IsTrue(validator.TryValidate(request, out results)); // GridReportOption - Manual (Direction/Azimuth) request = CompactionReportGridRequest.CreateCompactionReportGridRequest( 1, null, null, -1, null, true, true, true, true, true, false, null, 1.0, GridReportOption.Direction, 0.0, 0.0, 0.0, 0.0, Math.PI); Assert.IsTrue(validator.TryValidate(request, out results)); }
private CompactionReportResult ConvertGridResult(CompactionReportGridRequest request, Stream stream) { log.LogDebug($"{nameof(ConvertGridResult)}"); // Unpack the data for the report and construct a stream containing the result var reportPackager = new TRaptorReportsPackager(TRaptorReportType.rrtGridReport) { ReturnCode = TRaptorReportReturnCode.rrrcUnknownError }; reportPackager.GridReport.ElevationReport = request.ReportElevation; reportPackager.GridReport.CutFillReport = request.ReportCutFill; reportPackager.GridReport.CMVReport = request.ReportCMV; reportPackager.GridReport.MDPReport = request.ReportMDP; reportPackager.GridReport.PassCountReport = request.ReportPassCount; reportPackager.GridReport.TemperatureReport = request.ReportTemperature; log.LogDebug($"{nameof(ConvertGridResult)}: Retrieving response data"); reportPackager.ReadFromStream(stream); var gridRows = new GridRow[reportPackager.GridReport.NumberOfRows]; // Populate an array of grid rows from the data for (var i = 0; i < reportPackager.GridReport.NumberOfRows; i++) { gridRows[i] = GridRow.CreateRow(reportPackager.GridReport.Rows[i], request); } var startTime = request.Filter != null && request.Filter.StartUtc.HasValue ? request.Filter.StartUtc.Value : DateTime.Now; var endTime = request.Filter != null && request.Filter.EndUtc.HasValue ? request.Filter.EndUtc.Value : DateTime.Now; var gridReport = GridReport.CreateGridReport(startTime, endTime, gridRows); return(CompactionReportResult.CreateExportDataResult(gridReport, 1)); }
public CompactionReportGridRequest CreateCompactionReportGridRequest( bool reportElevation, bool reportCmv, bool reportMdp, bool reportPassCount, bool reportTemperature, bool reportCutFill, DesignDescriptor designFile, double?gridInerval, GridReportOption gridReportOption, double startNorthing, double startEasting, double endNorthing, double endEasting, double azimuth) { var liftBuildSettings = SettingsManager.CompactionLiftBuildSettings(ProjectSettings); return(CompactionReportGridRequest.CreateCompactionReportGridRequest( ProjectId, ProjectUid, Filter, Filter != null ? Filter.Id ?? -1 : -1, liftBuildSettings, reportElevation, reportCmv, reportMdp, reportPassCount, reportTemperature, reportCutFill, designFile, gridInerval, gridReportOption, startNorthing, startEasting, endNorthing, endEasting, azimuth)); }