Initial commit: Client Doc docs Server Tools
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using Xunit;
|
||||
using XWorld.PublishTool;
|
||||
|
||||
namespace XWorld.PublishTool.Tests
|
||||
{
|
||||
public class CliOptionsTests
|
||||
{
|
||||
[Fact]
|
||||
public void Parse_AllArgs_Ok()
|
||||
{
|
||||
var o = CliOptions.Parse(new[]
|
||||
{ "--mode", "client", "--src", "S", "--out", "O", "--spec", "spec.json", "--key", "k.pem" });
|
||||
Assert.Equal("client", o.Mode);
|
||||
Assert.Equal("S", o.Src);
|
||||
Assert.Equal("O", o.Out);
|
||||
Assert.Equal("spec.json", o.SpecPath);
|
||||
Assert.Equal("k.pem", o.KeyPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Parse_KeyOptional()
|
||||
{
|
||||
var o = CliOptions.Parse(new[] { "--mode", "server", "--src", "S", "--out", "O", "--spec", "sp" });
|
||||
Assert.Null(o.KeyPath);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(new object[] { new[] { "--mode", "bogus", "--src", "S", "--out", "O", "--spec", "sp" } })]
|
||||
[InlineData(new object[] { new[] { "--src", "S", "--out", "O", "--spec", "sp" } })]
|
||||
[InlineData(new object[] { new[] { "--mode", "client", "--out", "O", "--spec", "sp" } })]
|
||||
public void Parse_Invalid_Throws(string[] args)
|
||||
=> Assert.Throws<System.ArgumentException>(() => CliOptions.Parse(args));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user