diff --git a/AsbCloudWebApi.IntegrationTests/Clients/IWellOperationClient.cs b/AsbCloudWebApi.IntegrationTests/Clients/IWellOperationClient.cs index 43497d6c..2db55d36 100644 --- a/AsbCloudWebApi.IntegrationTests/Clients/IWellOperationClient.cs +++ b/AsbCloudWebApi.IntegrationTests/Clients/IWellOperationClient.cs @@ -1,4 +1,5 @@ using AsbCloudApp.Data; +using Microsoft.AspNetCore.Mvc; using Refit; namespace AsbCloudWebApi.IntegrationTests.Clients; @@ -10,4 +11,7 @@ public interface IWellOperationClient [Post(BaseRoute + "/{idType}/{deleteBeforeInsert}")] Task> InsertRangeAsync(int idWell, int idType, bool deleteBeforeInsert, [Body] IEnumerable dtos); + [Put(BaseRoute + "/{idOperation}")] + Task> UpdateAsync(int idWell, int idOperation, [FromBody] WellOperationDto value, CancellationToken token); + } \ No newline at end of file diff --git a/AsbCloudWebApi.IntegrationTests/Controllers/WellOperationControllerTest.cs b/AsbCloudWebApi.IntegrationTests/Controllers/WellOperationControllerTest.cs index 2651243f..809ccf1d 100644 --- a/AsbCloudWebApi.IntegrationTests/Controllers/WellOperationControllerTest.cs +++ b/AsbCloudWebApi.IntegrationTests/Controllers/WellOperationControllerTest.cs @@ -151,4 +151,34 @@ public class WellOperationControllerTest : BaseIntegrationTest //assert Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); } + + /// + /// Успешное обновление операции + /// + /// + [Fact] + public async Task UpdateAsync_returns_success() + { + //act + var dto = dtos.FirstOrDefault()!; + var response = await wellOperationClient.UpdateAsync(idWell, 1, dto, CancellationToken.None); + + //assert + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + } + + /// + /// Неуспешное обновление операции + /// + /// + [Fact] + public async Task UpdateAsync_returns_error() + { + //act + var dto = dtosWithError.LastOrDefault()!; + var response = await wellOperationClient.UpdateAsync(idWell, 1, dto, CancellationToken.None); + + //assert + Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); + } } \ No newline at end of file diff --git a/AsbCloudWebApi.IntegrationTests/Data/Defaults.cs b/AsbCloudWebApi.IntegrationTests/Data/Defaults.cs index fc36eb3f..45219449 100644 --- a/AsbCloudWebApi.IntegrationTests/Data/Defaults.cs +++ b/AsbCloudWebApi.IntegrationTests/Data/Defaults.cs @@ -19,7 +19,7 @@ namespace AsbCloudWebApi.IntegrationTests.Data { new() { - Id = 2, + Id = 1, IdWell = 1, IdType = 1, DateStart = DateTimeOffset.UtcNow.AddDays(-1),