35 lines
993 B
C#
35 lines
993 B
C#
using DongfangHydro.Dashboard.Api.Importing;
|
|
using Xunit;
|
|
|
|
namespace DongfangHydro.Dashboard.Tests;
|
|
|
|
public sealed class BomImportCommandTests
|
|
{
|
|
[Fact]
|
|
public void Parse_reads_file_and_switches()
|
|
{
|
|
var command = BomImportCommand.Parse(
|
|
["import-bom", "--file", "C:/data/bom.xlsx", "--purge-demo", "--validate-only", "--force"]);
|
|
|
|
Assert.NotNull(command);
|
|
Assert.Equal("C:/data/bom.xlsx", command.FilePath);
|
|
Assert.True(command.PurgeDemo);
|
|
Assert.True(command.ValidateOnly);
|
|
Assert.True(command.Force);
|
|
}
|
|
|
|
[Fact]
|
|
public void Parse_returns_null_for_normal_web_host_arguments()
|
|
{
|
|
Assert.Null(BomImportCommand.Parse(["--urls", "http://localhost:5080"]));
|
|
}
|
|
|
|
[Fact]
|
|
public void Parse_rejects_import_without_a_file()
|
|
{
|
|
var exception = Assert.Throws<BomImportException>(() => BomImportCommand.Parse(["import-bom"]));
|
|
|
|
Assert.Contains("--file", exception.Message);
|
|
}
|
|
}
|