forked from ddrilling/AsbCloudServer
49 lines
1.7 KiB
C#
49 lines
1.7 KiB
C#
using AsbCloudInfrastructure.Services.Trajectory.Import;
|
|
using System.Linq;
|
|
using Xunit;
|
|
|
|
namespace AsbCloudWebApi.Tests.UnitTests.Services.Trajectory
|
|
{
|
|
public class TrajectoryImportTest
|
|
{
|
|
private readonly TrajectoryPlanParserService trajectoryPlanImportService;
|
|
private readonly TrajectoryFactManualParserService trajectoryFactManualImportService;
|
|
|
|
private string usingTemplateFile = "AsbCloudWebApi.Tests.Services.Trajectory.Templates";
|
|
|
|
public TrajectoryImportTest()
|
|
{
|
|
trajectoryPlanImportService = new TrajectoryPlanParserService();
|
|
trajectoryFactManualImportService = new TrajectoryFactManualParserService();
|
|
}
|
|
|
|
[Fact]
|
|
public void Import_trajectory_planned()
|
|
{
|
|
var stream = System.Reflection.Assembly.GetExecutingAssembly()
|
|
.GetManifestResourceStream($"{usingTemplateFile}.TrajectoryPlanTemplate.xlsx");
|
|
|
|
if (stream is null)
|
|
Assert.Fail("Файла для импорта не существует");
|
|
|
|
var trajectoryRows = trajectoryPlanImportService.Import(stream);
|
|
|
|
Assert.Equal(3, trajectoryRows.Count());
|
|
}
|
|
|
|
[Fact]
|
|
public void Import_trajectory_fact_manual()
|
|
{
|
|
var stream = System.Reflection.Assembly.GetExecutingAssembly()
|
|
.GetManifestResourceStream($"{usingTemplateFile}.TrajectoryFactManualTemplate.xlsx");
|
|
|
|
if (stream is null)
|
|
Assert.Fail("Файла для импорта не существует");
|
|
|
|
var trajectoryRows = trajectoryFactManualImportService.Import(stream);
|
|
|
|
Assert.Equal(4, trajectoryRows.Count());
|
|
}
|
|
}
|
|
}
|