forked from ddrilling/AsbCloudServer
fix SlipsStatControllerTest
This commit is contained in:
parent
514d4fe80a
commit
855b483f22
@ -2,6 +2,7 @@ using AsbCloudApp.Data;
|
|||||||
using AsbCloudApp.Requests;
|
using AsbCloudApp.Requests;
|
||||||
using AsbCloudDb.Model;
|
using AsbCloudDb.Model;
|
||||||
using AsbCloudWebApi.IntegrationTests.Clients;
|
using AsbCloudWebApi.IntegrationTests.Clients;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace AsbCloudWebApi.IntegrationTests.Controllers;
|
namespace AsbCloudWebApi.IntegrationTests.Controllers;
|
||||||
@ -10,7 +11,7 @@ public class SlipsStatControllerTest : BaseIntegrationTest
|
|||||||
{
|
{
|
||||||
private static readonly Schedule schedule = new()
|
private static readonly Schedule schedule = new()
|
||||||
{
|
{
|
||||||
Id = 1,
|
Id = 0,
|
||||||
IdDriller = Data.Defaults.Drillers[0].Id,
|
IdDriller = Data.Defaults.Drillers[0].Id,
|
||||||
IdWell = Data.Defaults.Wells[0].Id,
|
IdWell = Data.Defaults.Wells[0].Id,
|
||||||
ShiftStart = new TimeOnly(8, 0, 0),
|
ShiftStart = new TimeOnly(8, 0, 0),
|
||||||
@ -21,7 +22,7 @@ public class SlipsStatControllerTest : BaseIntegrationTest
|
|||||||
|
|
||||||
private static readonly DetectedOperation detectedOperation = new()
|
private static readonly DetectedOperation detectedOperation = new()
|
||||||
{
|
{
|
||||||
Id = 1,
|
Id = 0,
|
||||||
IdTelemetry = Data.Defaults.Telemetries[0].Id,
|
IdTelemetry = Data.Defaults.Telemetries[0].Id,
|
||||||
IdCategory = WellOperationCategory.IdSlipsTime,
|
IdCategory = WellOperationCategory.IdSlipsTime,
|
||||||
DateStart = new DateTimeOffset(new DateTime(2024, 1, 23, 15, 0, 0, 0, DateTimeKind.Utc)),
|
DateStart = new DateTimeOffset(new DateTime(2024, 1, 23, 15, 0, 0, 0, DateTimeKind.Utc)),
|
||||||
@ -34,7 +35,7 @@ public class SlipsStatControllerTest : BaseIntegrationTest
|
|||||||
|
|
||||||
private static readonly WellOperation factWellOperation = new()
|
private static readonly WellOperation factWellOperation = new()
|
||||||
{
|
{
|
||||||
Id = 1,
|
Id = 0,
|
||||||
IdWell = Data.Defaults.Wells[0].Id,
|
IdWell = Data.Defaults.Wells[0].Id,
|
||||||
IdWellSectionType = 1,
|
IdWellSectionType = 1,
|
||||||
IdCategory = WellOperationCategory.IdRotor,
|
IdCategory = WellOperationCategory.IdRotor,
|
||||||
@ -51,9 +52,18 @@ public class SlipsStatControllerTest : BaseIntegrationTest
|
|||||||
public SlipsStatControllerTest(WebAppFactoryFixture factory)
|
public SlipsStatControllerTest(WebAppFactoryFixture factory)
|
||||||
: base(factory)
|
: base(factory)
|
||||||
{
|
{
|
||||||
dbContext.Schedule.Add(schedule);
|
var schedules = dbContext.Set<Schedule>();
|
||||||
dbContext.DetectedOperations.Add(detectedOperation);
|
var detectedOperations = dbContext.Set<DetectedOperation>();
|
||||||
dbContext.WellOperations.Add(factWellOperation);
|
var wellOperations = dbContext.Set<WellOperation>();
|
||||||
|
|
||||||
|
schedules.RemoveRange(schedules);
|
||||||
|
detectedOperations.RemoveRange(detectedOperations);
|
||||||
|
wellOperations.RemoveRange(wellOperations);
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
|
||||||
|
schedules.Add(schedule);
|
||||||
|
detectedOperations.Add(detectedOperation);
|
||||||
|
wellOperations.Add(factWellOperation);
|
||||||
dbContext.SaveChanges();
|
dbContext.SaveChanges();
|
||||||
|
|
||||||
client = factory.GetAuthorizedHttpClient<ISlipsTimeClient>();
|
client = factory.GetAuthorizedHttpClient<ISlipsTimeClient>();
|
||||||
|
Loading…
Reference in New Issue
Block a user