DD.WellWorkover.Cloud/AsbCloudInfrastructure.Tests/Services/Trajectory/TrajectoryParserTest.cs
2024-08-19 10:57:31 +05:00

44 lines
1.5 KiB
C#

using System.Linq;
using AsbCloudApp.Requests.ParserOptions;
using AsbCloudInfrastructure.Services.Trajectory.Parser;
using Xunit;
namespace AsbCloudInfrastructure.Tests.Services.Trajectory;
public class TrajectoryParserTest
{
private const string UsingTemplateFile = "AsbCloudWebApi.Tests.Services.Trajectory.Templates";
private readonly WellRelatedParserRequest options = new(1);
private readonly TrajectoryPlanParser trajectoryPlanParser = new();
private readonly TrajectoryFactManualParser trajectoryFactManualParser = new();
[Fact]
public void Parse_trajectory_plan()
{
var stream = System.Reflection.Assembly.GetExecutingAssembly()
.GetManifestResourceStream($"{UsingTemplateFile}.TrajectoryPlanTemplate.xlsx");
if (stream is null)
Assert.Fail("Файла для импорта не существует");
var trajectoryRows = trajectoryPlanParser.Parse(stream, options);
Assert.Equal(3, trajectoryRows.Item.Count());
}
[Fact]
public void Parse_trajectory_fact_manual()
{
var stream = System.Reflection.Assembly.GetExecutingAssembly()
.GetManifestResourceStream($"{UsingTemplateFile}.TrajectoryFactManualTemplate.xlsx");
if (stream is null)
Assert.Fail("Файла для импорта не существует");
var trajectoryRows = trajectoryFactManualParser.Parse(stream, options);
Assert.Equal(4, trajectoryRows.Item.Count());
}
}