DD.WellWorkover.Cloud/AsbCloudWebApi.Tests/UnitTests/Services/Trajectory/TrajectoryImportTest.cs

49 lines
1.7 KiB
C#
Raw Normal View History

2023-11-30 09:40:51 +05:00
using AsbCloudInfrastructure.Services.Trajectory.Import;
2023-11-28 15:54:47 +05:00
using System.Linq;
using Xunit;
namespace AsbCloudWebApi.Tests.UnitTests.Services.Trajectory
2023-11-28 15:54:47 +05:00
{
public class TrajectoryImportTest
{
2023-11-30 09:40:51 +05:00
private readonly TrajectoryPlannedParserService trajectoryPlannedImportService;
private readonly TrajectoryFactManualParserService trajectoryFactManualImportService;
2023-11-28 15:54:47 +05:00
private string usingTemplateFile = "AsbCloudWebApi.Tests.Services.Trajectory.Templates";
public TrajectoryImportTest()
{
2023-11-30 09:40:51 +05:00
trajectoryPlannedImportService = new TrajectoryPlannedParserService();
trajectoryFactManualImportService = new TrajectoryFactManualParserService();
2023-11-28 15:54:47 +05:00
}
[Fact]
2023-11-30 09:40:51 +05:00
public void Import_trajectory_planned()
2023-11-28 15:54:47 +05:00
{
var stream = System.Reflection.Assembly.GetExecutingAssembly()
.GetManifestResourceStream($"{usingTemplateFile}.TrajectoryPlannedTemplate.xlsx");
if (stream is null)
Assert.Fail("Файла для импорта не существует");
2023-11-30 09:40:51 +05:00
var trajectoryRows = trajectoryPlannedImportService.ImportAsync(stream);
2023-11-28 15:54:47 +05:00
Assert.Equal(3, trajectoryRows.Count());
}
[Fact]
2023-11-30 09:40:51 +05:00
public void Import_trajectory_fact_manual()
2023-11-28 15:54:47 +05:00
{
var stream = System.Reflection.Assembly.GetExecutingAssembly()
.GetManifestResourceStream($"{usingTemplateFile}.TrajectoryFactManualTemplate.xlsx");
if (stream is null)
Assert.Fail("Файла для импорта не существует");
2023-11-30 09:40:51 +05:00
var trajectoryRows = trajectoryFactManualImportService.ImportAsync(stream);
2023-11-28 15:54:47 +05:00
Assert.Equal(4, trajectoryRows.Count());
}
}
}