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