using AsbCloudApp.Data; using AsbCloudApp.Data.ProcessMapPlan; using AsbCloudApp.Requests; using AsbCloudDb.Model; using AsbCloudDb.Model.ProcessMaps; using AsbCloudWebApi.IntegrationTests.Clients; using System.Net; using Xunit; namespace AsbCloudWebApi.IntegrationTests.Controllers; public class WellOperationControllerTest : BaseIntegrationTest { private readonly int idWell = 4; private readonly WellOperationDto[] dtos = new WellOperationDto[] { new WellOperationDto() { }, new WellOperationDto() { } }; private IWellOperationClient wellOperationClient; public WellOperationControllerTest(WebAppFactoryFixture factory) : base(factory) { wellOperationClient = factory.GetAuthorizedHttpClient(); var rep = factory.Get } /// /// Успешное добавление операции с предварительной очисткой /// /// [Fact] public async Task InsertRangeWithDeleteBefore_returns_success() { ////arrange //dbContext.WellOperations.Add(wellOperation); //dbContext.SaveChanges(); //var request = new OperationStatRequest //{ // DateStartUTC = schedule.DrillStart.DateTime, // DateEndUTC = schedule.DrillEnd.DateTime, // DurationMinutesMin = 0, // DurationMinutesMax = 5 //}; //var dtoExpected = new SlipsStatDto //{ // DrillerName = $"{Data.Defaults.Drillers[0].Surname} {Data.Defaults.Drillers[0].Name} {Data.Defaults.Drillers[0].Patronymic}", // WellCount = 1, // SectionCaption = "Пилотный ствол", // SlipsCount = 1, // SlipsTimeInMinutes = (detectedOperation.DateEnd - detectedOperation.DateStart).TotalMinutes, // SectionDepth = factWellOperation.DepthEnd - factWellOperation.DepthStart, //}; ////act //var response = await slipsTimeClient.GetAll(request); ////assert //Assert.NotNull(response.Content); //Assert.Single(response.Content); //var dtoActual = response.Content.First(); //MatchHelper.Match(dtoExpected, dtoActual); } /// /// Успешное добавление операции без очистки /// /// [Fact] public async Task InsertRange_returns_success() { //arrange var dbset = dbContext.Set(); dbset.RemoveRange(dbset); dbContext.SaveChanges(); operationRepository.Validate(dtos); //act var response = await wellOperationClient.InsertRange(idWell, dtos); //assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); } /// /// Неуспешное добавление операции с предварительной очисткой /// /// [Fact] public async Task InsertRangeWithDeleteBefore_returns_error() { } /// /// Неуспешное добавление операции без очистки /// /// [Fact] public async Task InsertRange_returns_error() { } }