forked from ddrilling/AsbCloudServer
115 lines
3.1 KiB
C#
115 lines
3.1 KiB
C#
|
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<IWellOperationClient>();
|
|||
|
var rep = factory.Get
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Успешное добавление операции с предварительной очисткой
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
[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);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Успешное добавление операции без очистки
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
[Fact]
|
|||
|
public async Task InsertRange_returns_success() {
|
|||
|
//arrange
|
|||
|
var dbset = dbContext.Set<WellOperation>();
|
|||
|
dbset.RemoveRange(dbset);
|
|||
|
dbContext.SaveChanges();
|
|||
|
|
|||
|
operationRepository.Validate(dtos);
|
|||
|
|
|||
|
//act
|
|||
|
var response = await wellOperationClient.InsertRange(idWell, dtos);
|
|||
|
|
|||
|
//assert
|
|||
|
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Неуспешное добавление операции с предварительной очисткой
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
[Fact]
|
|||
|
public async Task InsertRangeWithDeleteBefore_returns_error()
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Неуспешное добавление операции без очистки
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
[Fact]
|
|||
|
public async Task InsertRange_returns_error()
|
|||
|
{
|
|||
|
}
|
|||
|
}
|