forked from ddrilling/AsbCloudServer
Правка автотеста по результатам ревью
This commit is contained in:
parent
ea0f8311ab
commit
ea9800e561
@ -1,20 +1,15 @@
|
|||||||
using AsbCloudApp.Data;
|
using AsbCloudApp.Data;
|
||||||
using AsbCloudApp.Data.SAUB;
|
using AsbCloudApp.Data.SAUB;
|
||||||
using AsbCloudApp.Repositories;
|
using AsbCloudApp.Repositories;
|
||||||
using AsbCloudApp.Requests;
|
|
||||||
using AsbCloudApp.Services;
|
using AsbCloudApp.Services;
|
||||||
using AsbCloudDb.Model;
|
|
||||||
using AsbCloudInfrastructure.Services;
|
using AsbCloudInfrastructure.Services;
|
||||||
using AsbCloudInfrastructure.Tests.MapData;
|
using AsbCloudInfrastructure.Tests.MapData;
|
||||||
using CsvHelper;
|
using CsvHelper;
|
||||||
using Mapster;
|
|
||||||
using NSubstitute;
|
using NSubstitute;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.NetworkInformation;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -24,7 +19,6 @@ namespace AsbCloudInfrastructure.Tests.Services;
|
|||||||
|
|
||||||
public class DataSaubStatDtillingQualityServiceTest
|
public class DataSaubStatDtillingQualityServiceTest
|
||||||
{
|
{
|
||||||
private const string UsingTemplateFile = "AsbCloudInfrastructure/Tests/Services/DataSaubStat";
|
|
||||||
private readonly IDataSaubStatRepository<DataSaubStatDrillingQualityDto> dataSaubStatRepositoryMock = Substitute.For<IDataSaubStatRepository<DataSaubStatDrillingQualityDto>>();
|
private readonly IDataSaubStatRepository<DataSaubStatDrillingQualityDto> dataSaubStatRepositoryMock = Substitute.For<IDataSaubStatRepository<DataSaubStatDrillingQualityDto>>();
|
||||||
private readonly ITelemetryDataCache<TelemetryDataSaubDto> telemetryDataCacheMock = Substitute.For<ITelemetryDataCache<TelemetryDataSaubDto>>();
|
private readonly ITelemetryDataCache<TelemetryDataSaubDto> telemetryDataCacheMock = Substitute.For<ITelemetryDataCache<TelemetryDataSaubDto>>();
|
||||||
private readonly ITelemetryDataSaubService dataSaubServiceMock = Substitute.For<ITelemetryDataSaubService>();
|
private readonly ITelemetryDataSaubService dataSaubServiceMock = Substitute.For<ITelemetryDataSaubService>();
|
||||||
@ -39,13 +33,16 @@ public class DataSaubStatDtillingQualityServiceTest
|
|||||||
dataSaubServiceMock);
|
dataSaubServiceMock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
[Fact]
|
[InlineData("DataSaubStat.test1.csv", "DataSaubStat.test1_result.csv")]
|
||||||
public async Task Create_DataSaubStatDrillingQuality_From_CSVFile_Test1_ShouldReturn_Success()
|
public async Task Create_DataSaubStatDrillingQuality_From_CSVFile_ShouldReturn_Success(
|
||||||
|
string pathMockData,
|
||||||
|
string pathResult
|
||||||
|
)
|
||||||
{
|
{
|
||||||
var resourceName = Assembly.GetExecutingAssembly()
|
var resourceName = Assembly.GetExecutingAssembly()
|
||||||
.GetManifestResourceNames()
|
.GetManifestResourceNames()
|
||||||
.Where(r => r.Contains("DataSaubStat.test1.csv"))
|
.Where(r => r.Contains(pathMockData))
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
|
|
||||||
if (String.IsNullOrEmpty(resourceName))
|
if (String.IsNullOrEmpty(resourceName))
|
||||||
@ -72,7 +69,7 @@ public class DataSaubStatDtillingQualityServiceTest
|
|||||||
|
|
||||||
resourceName = Assembly.GetExecutingAssembly()
|
resourceName = Assembly.GetExecutingAssembly()
|
||||||
.GetManifestResourceNames()
|
.GetManifestResourceNames()
|
||||||
.Where(r => r.Contains("DataSaubStat.test1_result.csv"))
|
.Where(r => r.Contains(pathResult))
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
|
|
||||||
if (String.IsNullOrEmpty(resourceName))
|
if (String.IsNullOrEmpty(resourceName))
|
||||||
@ -87,6 +84,7 @@ public class DataSaubStatDtillingQualityServiceTest
|
|||||||
csv.Context.RegisterClassMap<DataSaubStatDrillingQualityDtoMap>();
|
csv.Context.RegisterClassMap<DataSaubStatDrillingQualityDtoMap>();
|
||||||
var expected = csv.GetRecords<DataSaubStatDrillingQualityDto>().ToList();
|
var expected = csv.GetRecords<DataSaubStatDrillingQualityDto>().ToList();
|
||||||
|
|
||||||
|
//assert
|
||||||
Assert.Equal(expected.Count(), actual.Count());
|
Assert.Equal(expected.Count(), actual.Count());
|
||||||
|
|
||||||
var expectedItem = expected.FirstOrDefault()!;
|
var expectedItem = expected.FirstOrDefault()!;
|
||||||
|
@ -37,6 +37,7 @@ public class TelemetryDataEditorService : ITelemetryDataEditorService
|
|||||||
ITelemetryDataSaubService dataSaubService,
|
ITelemetryDataSaubService dataSaubService,
|
||||||
ITelemetryDataService<TelemetryDataSpinDto> dataSpinService,
|
ITelemetryDataService<TelemetryDataSpinDto> dataSpinService,
|
||||||
IDataSaubStatRepository<DataSaubStatDto> dataSaubStatRepository,
|
IDataSaubStatRepository<DataSaubStatDto> dataSaubStatRepository,
|
||||||
|
IDataSaubStatRepository<DataSaubStatDrillingQualityDto> dataSaubStatDrillingQualityRepository,
|
||||||
IMessageRepository messageRepository,
|
IMessageRepository messageRepository,
|
||||||
IDrillTestRepository drillTestRepository,
|
IDrillTestRepository drillTestRepository,
|
||||||
ILimitingParameterRepository limitingParameterRepository,
|
ILimitingParameterRepository limitingParameterRepository,
|
||||||
@ -55,6 +56,7 @@ public class TelemetryDataEditorService : ITelemetryDataEditorService
|
|||||||
dataSaubService,
|
dataSaubService,
|
||||||
dataSpinService,
|
dataSpinService,
|
||||||
dataSaubStatRepository,
|
dataSaubStatRepository,
|
||||||
|
dataSaubStatDrillingQualityRepository,
|
||||||
messageRepository,
|
messageRepository,
|
||||||
drillTestRepository,
|
drillTestRepository,
|
||||||
limitingParameterRepository,
|
limitingParameterRepository,
|
||||||
|
Loading…
Reference in New Issue
Block a user