From 59d295a4f2aa4c385513bb677c3993e3cfd0a2d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Thu, 11 Apr 2024 09:37:11 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=B8=D0=BD=D1=82=D0=B5=D0=B3=D1=80=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D0=BE=D0=BD=D0=BD=D1=8B=D0=B9=20=D1=82=D0=B5=D1=81=D1=82,=20?= =?UTF-8?q?=D0=BA=D0=BE=D1=82=D0=BE=D1=80=D1=8B=D0=B9=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B5=D1=80=D1=8F=D0=B5=D1=82=20=D0=BF=D0=B0=D0=B3=D0=B8?= =?UTF-8?q?=D0=BD=D0=B0=D1=86=D0=B8=D1=8E=20=D0=B2=20=D0=93=D0=93=D0=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Clients/IWellOperationClient.cs | 2 +- .../WellOperationControllerTest.cs | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/AsbCloudWebApi.IntegrationTests/Clients/IWellOperationClient.cs b/AsbCloudWebApi.IntegrationTests/Clients/IWellOperationClient.cs index 84906a77..b9e63518 100644 --- a/AsbCloudWebApi.IntegrationTests/Clients/IWellOperationClient.cs +++ b/AsbCloudWebApi.IntegrationTests/Clients/IWellOperationClient.cs @@ -19,7 +19,7 @@ public interface IWellOperationClient Task> UpdateRangeAsync(int idWell, [Body] IEnumerable dtos); [Get(BaseRoute)] - Task>> GetPageOperationsPlanAsync(int idWell, [Query] WellOperationRequestBase request); + Task>> GetPageOperationsAsync(int idWell, [Query] WellOperationRequestBase request); [Multipart] [Post(BaseRoute + "/parse/{idType}")] diff --git a/AsbCloudWebApi.IntegrationTests/Controllers/WellOperations/WellOperationControllerTest.cs b/AsbCloudWebApi.IntegrationTests/Controllers/WellOperations/WellOperationControllerTest.cs index 4d6dd3c0..1a700189 100644 --- a/AsbCloudWebApi.IntegrationTests/Controllers/WellOperations/WellOperationControllerTest.cs +++ b/AsbCloudWebApi.IntegrationTests/Controllers/WellOperations/WellOperationControllerTest.cs @@ -89,9 +89,12 @@ public class WellOperationControllerTest : BaseIntegrationTest /// /// [Fact] - public async Task GetPageOperationsPlanAsync_returns_success() + public async Task GetPageOperationsAsync_returns_first_page() { //arrange + const int pageSize = 10; + const int pageIndex = 0; + var well = await dbContext.Wells.FirstAsync(); var entity = CreateWellOperation(well.Id); dbContext.WellOperations.Add(entity); @@ -104,17 +107,22 @@ public class WellOperationControllerTest : BaseIntegrationTest var request = new WellOperationRequestBase { - OperationType = WellOperation.IdOperationTypePlan + OperationType = WellOperation.IdOperationTypePlan, + Skip = pageIndex, + Take = pageSize, }; //act - var response = await client.GetPageOperationsPlanAsync(well.Id, request); + var response = await client.GetPageOperationsAsync(well.Id, request); //assert Assert.Equal(response.StatusCode, HttpStatusCode.OK); Assert.NotNull(response.Content); - Assert.Single(response.Content.Items); + var totalExpected = response.Content.Count - pageSize * pageIndex; + Assert.Equal(totalExpected, response.Content.Items.Count()); + + Assert.Single(response.Content.Items); var actualDto = response.Content.Items.First(); MatchHelper.Match(dto, actualDto);