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.UnitTests.Services.Trajectory.Templates"; public TrajectoryImportTest() { trajectoryPlanImportService = new TrajectoryPlanParserService(); trajectoryFactManualImportService = new TrajectoryFactManualParserService(); } [Fact] public void Import_trajectory_plan() { 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()); } } }