diff --git a/AsbCloudWebApi.IntegrationTests/Clients/IProcessMapReportDrilling.cs b/AsbCloudWebApi.IntegrationTests/Clients/IProcessMapReportDrilling.cs index b721df75..12adac91 100644 --- a/AsbCloudWebApi.IntegrationTests/Clients/IProcessMapReportDrilling.cs +++ b/AsbCloudWebApi.IntegrationTests/Clients/IProcessMapReportDrilling.cs @@ -13,4 +13,8 @@ public interface IProcessMapReportDrilling [Get($"{BaseRoute}/report")] Task>> GetReportAsync(int idWell, [FromQuery] DataSaubStatRequest request, CancellationToken cancellationToken); + + [Get($"{BaseRoute}/report/export")] + Task> ExportReportAsync(int idWell, [FromQuery] DataSaubStatRequest request, CancellationToken cancellationToken); + } diff --git a/AsbCloudWebApi.IntegrationTests/Controllers/ProcessMapPlan/ProcessMapReportDrillingControllerTest.cs b/AsbCloudWebApi.IntegrationTests/Controllers/ProcessMapPlan/ProcessMapReportDrillingControllerTest.cs index 2d08b0c8..77951c23 100644 --- a/AsbCloudWebApi.IntegrationTests/Controllers/ProcessMapPlan/ProcessMapReportDrillingControllerTest.cs +++ b/AsbCloudWebApi.IntegrationTests/Controllers/ProcessMapPlan/ProcessMapReportDrillingControllerTest.cs @@ -172,7 +172,6 @@ public class ProcessMapReportDrillingControllerTest: BaseIntegrationTest public ProcessMapReportDrillingControllerTest(WebAppFactoryFixture factory) : base(factory) { - dbContext.CleanupDbSet(); client = factory.GetAuthorizedHttpClient(); } @@ -181,6 +180,9 @@ public class ProcessMapReportDrillingControllerTest: BaseIntegrationTest [Fact] public async Task Get_rtk_report_returns_success() { + //clear + dbContext.CleanupDbSet(); + //arrange var dbset = dbContext.Set(); dbset.Add(entity); @@ -234,4 +236,38 @@ public class ProcessMapReportDrillingControllerTest: BaseIntegrationTest //assert Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); } + + [Fact] + public async Task Export_rtk_report_returns_success() + { + //clear + dbContext.CleanupDbSet(); + + //arrange + var dbset = dbContext.Set(); + dbset.Add(entity); + entity.Id = 1; + dbset.Add(entity); + entity.Id = 2; + dbset.Add(entity); + + var dbSetWellOperationCategory = dbContext.Set(); + dbSetWellOperationCategory.Add(wellOperationCategory); + + var dbSetWellOperation = dbContext.Set(); + dbSetWellOperation.Add(wellOperation); + + var dbSetDataSaubStat = dbContext.Set(); + dbSetDataSaubStat.AddRange(dataSaubStats); + + dbContext.SaveChanges(); + + //act + var request = new DataSaubStatRequest(); + var response = await client.ExportReportAsync(1, request, CancellationToken.None); + + //assert + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + Assert.NotNull(response.Content); + } }