Интеграционные тест на скаичвание РТК-отчета

This commit is contained in:
Olga Nemt 2024-02-29 09:10:15 +05:00
parent f570e82b41
commit b389b181d5
2 changed files with 41 additions and 1 deletions

View File

@ -13,4 +13,8 @@ public interface IProcessMapReportDrilling
[Get($"{BaseRoute}/report")]
Task<IApiResponse<IEnumerable<ProcessMapReportDataSaubStatDto>>> GetReportAsync(int idWell, [FromQuery] DataSaubStatRequest request, CancellationToken cancellationToken);
[Get($"{BaseRoute}/report/export")]
Task<IApiResponse<IActionResult>> ExportReportAsync(int idWell, [FromQuery] DataSaubStatRequest request, CancellationToken cancellationToken);
}

View File

@ -172,7 +172,6 @@ public class ProcessMapReportDrillingControllerTest: BaseIntegrationTest
public ProcessMapReportDrillingControllerTest(WebAppFactoryFixture factory) : base(factory)
{
dbContext.CleanupDbSet<ProcessMapPlanDrilling>();
client = factory.GetAuthorizedHttpClient<IProcessMapReportDrilling>();
}
@ -181,6 +180,9 @@ public class ProcessMapReportDrillingControllerTest: BaseIntegrationTest
[Fact]
public async Task Get_rtk_report_returns_success()
{
//clear
dbContext.CleanupDbSet<ProcessMapPlanDrilling>();
//arrange
var dbset = dbContext.Set<ProcessMapPlanDrilling>();
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<ProcessMapPlanDrilling>();
//arrange
var dbset = dbContext.Set<ProcessMapPlanDrilling>();
dbset.Add(entity);
entity.Id = 1;
dbset.Add(entity);
entity.Id = 2;
dbset.Add(entity);
var dbSetWellOperationCategory = dbContext.Set<WellOperationCategory>();
dbSetWellOperationCategory.Add(wellOperationCategory);
var dbSetWellOperation = dbContext.Set<WellOperation>();
dbSetWellOperation.Add(wellOperation);
var dbSetDataSaubStat = dbContext.Set<DataSaubStat>();
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);
}
}