public async Task ApplicationService_DefaultFilterToFilter_Execute_SingleCell_CutOnly() { const int numProgressiveVolumes = 10; AddApplicationGridRouting(); AddClusterComputeGridRouting(); AddSimpleNEEToLLHConversionMock(); var baseTime = DateTime.UtcNow; var timeIncrement = new TimeSpan(0, 1, 0); var cellPassHeightIncrement = -ELEVATION_INCREMENT_0_5; var siteModel = BuildModelForSingleCellProgressiveVolume(numProgressiveVolumes + 1, baseTime, timeIncrement, 1.0f, cellPassHeightIncrement); var(startUtc, endUtc) = siteModel.GetDateRange(); startUtc.Should().Be(baseTime); endUtc.Should().Be(baseTime + numProgressiveVolumes * timeIncrement); var request = new ProgressiveVolumesRequest_ApplicationService(); var arg = new ProgressiveVolumesRequestArgument { StartDate = startUtc, EndDate = endUtc, Interval = new TimeSpan((endUtc.Ticks - startUtc.Ticks) / numProgressiveVolumes), ProjectID = siteModel.ID, VolumeType = VolumeComputationType.Between2Filters, Filters = new FilterSet(new CombinedFilter()), BaseDesign = new DesignOffset(), TopDesign = new DesignOffset(), CutTolerance = 0.001, FillTolerance = 0.001 }; var response = await request.ExecuteAsync(arg); CheckDefaultSingleCellAtOriginResponse(response); response.Volumes.Length.Should().Be(numProgressiveVolumes); for (var i = 0; i < response.Volumes.Length - 1; i++) { response.Volumes[i].Date.Should().BeBefore(response.Volumes[i + 1].Date); } for (var i = 0; i < response.Volumes.Length; i++) { response.Volumes[i].Date.Should().Be(baseTime + (i + 1) * timeIncrement); response.Volumes[i].Volume.TotalCoverageArea.Should().Be(SubGridTreeConsts.DefaultCellSize * SubGridTreeConsts.DefaultCellSize); response.Volumes[i].Volume.Fill.Should().Be(0); response.Volumes[i].Volume.Cut.Should().Be(-(cellPassHeightIncrement * SubGridTreeConsts.DefaultCellSize * SubGridTreeConsts.DefaultCellSize)); response.Volumes[i].Volume.FillArea.Should().Be(0); response.Volumes[i].Volume.CutArea.Should().Be(SubGridTreeConsts.DefaultCellSize * SubGridTreeConsts.DefaultCellSize); } }
public async Task ApplicationService_DefaultFilterToFilter_Execute_NoData() { AddApplicationGridRouting(); AddClusterComputeGridRouting(); var request = new ProgressiveVolumesRequest_ApplicationService(); var response = await request.ExecuteAsync(DefaultRequestArg(Guid.NewGuid())); // This is a no data test, so the response will be null CheckResponseContainsNullValues(response); }
public async Task FailWithNoDefinedBaseOrTopSurfaceDesign(VolumeComputationType volumeType) { AddApplicationGridRouting(); AddClusterComputeGridRouting(); var tagFiles = new[] { Path.Combine(TestHelper.CommonTestDataPath, "TestTAGFile.tag"), }; var siteModel = DITAGFileAndSubGridRequestsFixture.BuildModel(tagFiles, out _); var request = new ProgressiveVolumesRequest_ApplicationService(); var response = await request.ExecuteAsync(DefaultRequestArgFromModel(siteModel, volumeType)); response.Should().NotBeNull(); response.Volumes.Should().BeNull(); response.ResultStatus.Should().NotBe(RequestErrorStatus.OK); }
public async Task ApplicationService_DefaultFilterToFilter_Execute_SingleTAGFile() { AddApplicationGridRouting(); AddClusterComputeGridRouting(); AddSimpleNEEToLLHConversionMock(); var tagFiles = new[] { Path.Combine(TestHelper.CommonTestDataPath, "TestTAGFile.tag"), }; var siteModel = DITAGFileAndSubGridRequestsFixture.BuildModel(tagFiles, out _); var request = new ProgressiveVolumesRequest_ApplicationService(); var response = await request.ExecuteAsync(DefaultRequestArgFromModel(siteModel, VolumeComputationType.Between2Filters)); response.Should().NotBeNull(); CheckDefaultFilterToFilterSingleTAGFileResponse(response); response.Volumes.Length.Should().Be(10); }
protected override async Task <ContractExecutionResult> ProcessAsyncEx <T>(T item) { var request = CastRequestObjectTo <ProgressiveSummaryVolumesDataRequest>(item);// as ProgressiveSummaryVolumesDataRequest; // ReSharper disable once PossibleNullReferenceException var siteModel = GetSiteModel(request.ProjectUid); var filter = ConvertFilter(request.Filter, siteModel); var additionalSpatialFilter = ConvertFilter(request.AdditionalSpatialFilter, siteModel); var tRexRequest = new ProgressiveVolumesRequest_ApplicationService(); var response = await tRexRequest.ExecuteAsync(new ProgressiveVolumesRequestArgument { ProjectID = siteModel.ID, Filters = new FilterSet(filter), // Progressive volumes use a single filter derived from the supplied base filter AdditionalSpatialFilter = additionalSpatialFilter, BaseDesign = new DesignOffset(request.BaseDesignUid ?? Guid.Empty, request.BaseDesignOffset ?? 0), TopDesign = new DesignOffset(request.TopDesignUid ?? Guid.Empty, request.TopDesignOffset ?? 0), VolumeType = ConvertVolumesHelper.ConvertVolumesType(request.VolumeCalcType), CutTolerance = request.CutTolerance ?? VolumesConsts.DEFAULT_CELL_VOLUME_CUT_TOLERANCE, FillTolerance = request.CutTolerance ?? VolumesConsts.DEFAULT_CELL_VOLUME_FILL_TOLERANCE, StartDate = request.StartDateUtc, EndDate = request.EndDateUtc, Interval = TimeSpan.FromSeconds(request.IntervalSeconds) }); if (response != null) { log.LogInformation($"Volume response is {JsonConvert.SerializeObject(response)}"); return(ConvertResult(response)); } log.LogWarning("Volume response is null"); throw new ServiceException(HttpStatusCode.BadRequest, new ContractExecutionResult(ContractExecutionStatesEnum.FailedToGetResults, "Failed to get requested Summary Volumes data")); }