forked from ddrilling/AsbCloudServer
Автотесты (продолжение) + правка бэка по результатам тестирования
This commit is contained in:
parent
e2e8612628
commit
7872e068ba
@ -58,27 +58,13 @@ public class DataSaubStatDtillingQualityServiceTest
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
private List<DetectedOperationDto> detectedOperationDtos = new List<DetectedOperationDto>() {
|
|
||||||
new DetectedOperationDto {
|
|
||||||
Id = 1,
|
|
||||||
DateEnd = DateTimeOffset.UtcNow,
|
|
||||||
DateStart = DateTimeOffset.UtcNow.AddHours(-1),
|
|
||||||
DepthStart = 1,
|
|
||||||
DepthEnd = 2,
|
|
||||||
IdCategory = 5002,
|
|
||||||
IdTelemetry = 1,
|
|
||||||
Value = 1,
|
|
||||||
IdEditor = 1,
|
|
||||||
IdUserAtStart = 1
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private List<TelemetryDataSaubDto> telemetryDataSaubDtos = new List<TelemetryDataSaubDto> {
|
private List<TelemetryDataSaubDto> telemetryDataSaubDtos = new List<TelemetryDataSaubDto> {
|
||||||
new TelemetryDataSaubDto()
|
new TelemetryDataSaubDto()
|
||||||
{
|
{
|
||||||
IdTelemetry = 1,
|
IdTelemetry = 1,
|
||||||
DateTime = DateTime.UtcNow.AddMinutes(-30),
|
DateTime = DateTime.UtcNow.AddMinutes(-30),
|
||||||
AxialLoad = 1,
|
AxialLoad = 800,
|
||||||
AxialLoadLimitMax = 1,
|
AxialLoadLimitMax = 1,
|
||||||
AxialLoadSp = 1,
|
AxialLoadSp = 1,
|
||||||
BitDepth = 1,
|
BitDepth = 1,
|
||||||
@ -117,7 +103,7 @@ public class DataSaubStatDtillingQualityServiceTest
|
|||||||
RotorTorqueIdle = 1,
|
RotorTorqueIdle = 1,
|
||||||
RotorTorqueSp = 1,
|
RotorTorqueSp = 1,
|
||||||
RotorTorqueLimitMax = 1,
|
RotorTorqueLimitMax = 1,
|
||||||
WellDepth = 10,
|
WellDepth = 800,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -134,24 +120,81 @@ public class DataSaubStatDtillingQualityServiceTest
|
|||||||
var telemetrySaubDto = telemetryDataSaubDtos.FirstOrDefault();
|
var telemetrySaubDto = telemetryDataSaubDtos.FirstOrDefault();
|
||||||
if (telemetrySaubDto != null)
|
if (telemetrySaubDto != null)
|
||||||
{
|
{
|
||||||
var telemetrySaubDto1 = CreateTelemetryDataSaubItem(telemetrySaubDto, 1, 1);
|
//idFeedRegulator depthWell
|
||||||
|
//1 800
|
||||||
|
//1 900
|
||||||
|
//1 1000
|
||||||
|
//1 900
|
||||||
|
//1 1200
|
||||||
|
//1 1300
|
||||||
|
//1 1100
|
||||||
|
//1 1500
|
||||||
|
//2 1600
|
||||||
|
//Îæèäàåìûå ðåçóëüòàòû äëÿ idFeedRegulator:
|
||||||
|
// depthWell = (1000 - 800) + (1300 - 900) + (1600 - 1100) =
|
||||||
|
var telemetrySaubDto1 = CreateTelemetryDataSaubItem(
|
||||||
|
telemetrySaubDto,
|
||||||
|
wellDepth: 900,
|
||||||
|
bitDepth: 900,
|
||||||
|
idFeedRegulator: 1,
|
||||||
|
dateTime: DateTime.UtcNow.AddMinutes(20));
|
||||||
telemetryDataSaubDtos.Add(telemetrySaubDto1);
|
telemetryDataSaubDtos.Add(telemetrySaubDto1);
|
||||||
|
|
||||||
var telemetrySaubDto2 = telemetrySaubDto.Adapt<TelemetryDataSaubDto>();
|
var telemetrySaubDto2 = CreateTelemetryDataSaubItem(
|
||||||
telemetrySaubDto2.WellDepth = 2;
|
telemetrySaubDto,
|
||||||
telemetrySaubDto2.BitDepth = 2;
|
wellDepth: 1000,
|
||||||
telemetrySaubDto2.IdFeedRegulator = 1;
|
bitDepth: 1000,
|
||||||
telemetrySaubDto2.DateTime = telemetrySaubDto1.DateTime.AddMinutes(20);
|
idFeedRegulator: 1,
|
||||||
|
dateTime: DateTime.UtcNow.AddMinutes(20));
|
||||||
telemetryDataSaubDtos.Add(telemetrySaubDto2);
|
telemetryDataSaubDtos.Add(telemetrySaubDto2);
|
||||||
|
|
||||||
var telemetrySaubDto3 = telemetrySaubDto.Adapt<TelemetryDataSaubDto>();
|
var telemetrySaubDto3 = CreateTelemetryDataSaubItem(
|
||||||
telemetrySaubDto3.WellDepth = 2;
|
telemetrySaubDto,
|
||||||
telemetrySaubDto3.BitDepth = 2;
|
wellDepth: 900,
|
||||||
telemetrySaubDto3.IdFeedRegulator = 1;
|
bitDepth: 900,
|
||||||
telemetrySaubDto3.DateTime = telemetrySaubDto2.DateTime.AddMinutes(20);
|
idFeedRegulator: 1,
|
||||||
|
dateTime: DateTime.UtcNow.AddMinutes(20));
|
||||||
telemetryDataSaubDtos.Add(telemetrySaubDto3);
|
telemetryDataSaubDtos.Add(telemetrySaubDto3);
|
||||||
|
|
||||||
|
var telemetrySaubDto4 = CreateTelemetryDataSaubItem(
|
||||||
|
telemetrySaubDto,
|
||||||
|
wellDepth: 1200,
|
||||||
|
bitDepth: 1200,
|
||||||
|
idFeedRegulator: 1,
|
||||||
|
dateTime: DateTime.UtcNow.AddMinutes(20));
|
||||||
|
telemetryDataSaubDtos.Add(telemetrySaubDto4);
|
||||||
|
|
||||||
|
var telemetrySaubDto5 = CreateTelemetryDataSaubItem(
|
||||||
|
telemetrySaubDto,
|
||||||
|
wellDepth: 1300,
|
||||||
|
bitDepth: 1300,
|
||||||
|
idFeedRegulator: 1,
|
||||||
|
dateTime: DateTime.UtcNow.AddMinutes(20));
|
||||||
|
telemetryDataSaubDtos.Add(telemetrySaubDto5);
|
||||||
|
|
||||||
|
var telemetrySaubDto6 = CreateTelemetryDataSaubItem(
|
||||||
|
telemetrySaubDto,
|
||||||
|
wellDepth: 1100,
|
||||||
|
bitDepth: 1100,
|
||||||
|
idFeedRegulator: 1,
|
||||||
|
dateTime: DateTime.UtcNow.AddMinutes(20));
|
||||||
|
telemetryDataSaubDtos.Add(telemetrySaubDto6);
|
||||||
|
|
||||||
|
var telemetrySaubDto7 = CreateTelemetryDataSaubItem(
|
||||||
|
telemetrySaubDto,
|
||||||
|
wellDepth: 1500,
|
||||||
|
bitDepth: 1500,
|
||||||
|
idFeedRegulator: 1,
|
||||||
|
dateTime: DateTime.UtcNow.AddMinutes(20));
|
||||||
|
telemetryDataSaubDtos.Add(telemetrySaubDto7);
|
||||||
|
|
||||||
|
var telemetrySaubDto8 = CreateTelemetryDataSaubItem(
|
||||||
|
telemetrySaubDto,
|
||||||
|
wellDepth: 1600,
|
||||||
|
bitDepth: 1600,
|
||||||
|
idFeedRegulator: 2,
|
||||||
|
dateTime: DateTime.UtcNow.AddMinutes(20));
|
||||||
|
telemetryDataSaubDtos.Add(telemetrySaubDto8);
|
||||||
}
|
}
|
||||||
|
|
||||||
dataSaubServiceMock
|
dataSaubServiceMock
|
||||||
@ -167,13 +210,15 @@ public class DataSaubStatDtillingQualityServiceTest
|
|||||||
private TelemetryDataSaubDto CreateTelemetryDataSaubItem(
|
private TelemetryDataSaubDto CreateTelemetryDataSaubItem(
|
||||||
TelemetryDataSaubDto telemetrySaubDto,
|
TelemetryDataSaubDto telemetrySaubDto,
|
||||||
float wellDepth,
|
float wellDepth,
|
||||||
float bitDepth)
|
float bitDepth,
|
||||||
|
short idFeedRegulator,
|
||||||
|
DateTime dateTime)
|
||||||
{
|
{
|
||||||
var telemetrySaubDto1 = telemetrySaubDto.Adapt<TelemetryDataSaubDto>();
|
var telemetrySaubDto1 = telemetrySaubDto.Adapt<TelemetryDataSaubDto>();
|
||||||
telemetrySaubDto1.WellDepth = wellDepth;
|
telemetrySaubDto1.WellDepth = wellDepth;
|
||||||
telemetrySaubDto1.BitDepth = bitDepth;
|
telemetrySaubDto1.BitDepth = bitDepth;
|
||||||
telemetrySaubDto1.IdFeedRegulator = 1;
|
telemetrySaubDto1.IdFeedRegulator = idFeedRegulator;
|
||||||
telemetrySaubDto1.DateTime = DateTime.UtcNow.AddMinutes(20);
|
telemetrySaubDto1.DateTime = dateTime;
|
||||||
|
|
||||||
return telemetrySaubDto1;
|
return telemetrySaubDto1;
|
||||||
}
|
}
|
||||||
@ -181,7 +226,7 @@ public class DataSaubStatDtillingQualityServiceTest
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Create_1DataSaubStatItems_ShouldReturn__Success()
|
public async Task Create_1DataSaubStatItems_ShouldReturn__Success()
|
||||||
{
|
{
|
||||||
var insertedDataSaubStatCount = 1;
|
var insertedDataSaubStatCount = 2;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -120,7 +120,17 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatDrillingQualitySe
|
|||||||
if (indexStart < 0)
|
if (indexStart < 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
indexEnd = Array.FindIndex(dataSaub, indexStart, t => t.IdFeedRegulator != idFeedRegulator);
|
indexEnd = indexStart + 1;
|
||||||
|
for (var i = indexStart + 1; i < dataSaub.Count(); i++)
|
||||||
|
{
|
||||||
|
if (dataSaub[i].WellDepth >= dataSaub[i - 1].WellDepth)
|
||||||
|
indexEnd = i;
|
||||||
|
else if (dataSaub[i].IdFeedRegulator != idFeedRegulator)
|
||||||
|
break;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (indexEnd < 0)
|
if (indexEnd < 0)
|
||||||
indexEnd = dataSaub.Length - 1;
|
indexEnd = dataSaub.Length - 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user