public void ProjectStatisticsExecutor_RaptorValidation_Success() { var excludedSurveyedSurfaceIds = new long[] { 555, 666, 777 }; var request = new ProjectStatisticsRequest(4545, excludedSurveyedSurfaceIds); request.Validate(); }
public void ProjectStatisticsExecutor_RaptorValidation_SSIdFailure() { var excludedSurveyedSurfaceIds = new long[] { 0, 666, 777 }; var request = new ProjectStatisticsRequest(5656, excludedSurveyedSurfaceIds); var ex = Assert.ThrowsException <ServiceException>(() => request.Validate()); Assert.IsNotNull(ex, "should be exception"); Assert.AreEqual(HttpStatusCode.BadRequest, ex.Code, "Invalid HttpStatusCode."); Assert.AreEqual(ContractExecutionStatesEnum.ValidationError, ex.GetResult.Code, "Invalid executionState."); Assert.AreEqual("Excluded Surface Id is invalid", ex.GetResult.Message, "Invalid error message."); }
public async Task <ProjectStatisticsResult> PostProjectStatisticsTbc([FromBody] ProjectStatisticsRequest request) { _log.LogDebug($"{nameof(PostProjectStatisticsTbc)}: {JsonConvert.SerializeObject(request)}"); if (!request.ProjectUid.HasValue) { request.ProjectUid = await((RaptorPrincipal)User).GetProjectUid(request.ProjectId ?? -1); } request.Validate(); var projectStatisticsHelper = new ProjectStatisticsHelper(_logger, configStore, FileImportProxy, tRexCompactionDataProxy, _log #if RAPTOR , raptorClient #endif ); return(await projectStatisticsHelper.GetProjectStatisticsWithRequestSsExclusions( request.ProjectUid ?? Guid.Empty, request.ProjectId ?? -1, GetUserId(), request.ExcludedSurveyedSurfaceIds, CustomHeaders)); }