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 AsbCloudDb.Model;
|
||||
using AsbCloudWebApi.IntegrationTests.Clients;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Xunit;
|
||||
|
||||
namespace AsbCloudWebApi.IntegrationTests.Controllers;
|
||||
@ -10,7 +11,7 @@ public class SlipsStatControllerTest : BaseIntegrationTest
|
||||
{
|
||||
private static readonly Schedule schedule = new()
|
||||
{
|
||||
Id = 1,
|
||||
Id = 0,
|
||||
IdDriller = Data.Defaults.Drillers[0].Id,
|
||||
IdWell = Data.Defaults.Wells[0].Id,
|
||||
ShiftStart = new TimeOnly(8, 0, 0),
|
||||
@ -21,7 +22,7 @@ public class SlipsStatControllerTest : BaseIntegrationTest
|
||||
|
||||
private static readonly DetectedOperation detectedOperation = new()
|
||||
{
|
||||
Id = 1,
|
||||
Id = 0,
|
||||
IdTelemetry = Data.Defaults.Telemetries[0].Id,
|
||||
IdCategory = WellOperationCategory.IdSlipsTime,
|
||||
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()
|
||||
{
|
||||
Id = 1,
|
||||
Id = 0,
|
||||
IdWell = Data.Defaults.Wells[0].Id,
|
||||
IdWellSectionType = 1,
|
||||
IdCategory = WellOperationCategory.IdRotor,
|
||||
@ -51,9 +52,18 @@ public class SlipsStatControllerTest : BaseIntegrationTest
|
||||
public SlipsStatControllerTest(WebAppFactoryFixture factory)
|
||||
: base(factory)
|
||||
{
|
||||
dbContext.Schedule.Add(schedule);
|
||||
dbContext.DetectedOperations.Add(detectedOperation);
|
||||
dbContext.WellOperations.Add(factWellOperation);
|
||||
var schedules = dbContext.Set<Schedule>();
|
||||
var detectedOperations = dbContext.Set<DetectedOperation>();
|
||||
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();
|
||||
|
||||
client = factory.GetAuthorizedHttpClient<ISlipsTimeClient>();
|
||||
|
Loading…
Reference in New Issue
Block a user