Add error for non-scalar parameters bound without any values (#71)

This commit is contained in:
Daniel Hix
2020-07-31 07:08:13 -05:00
committed by GitHub
parent 9a20101f30
commit 432430489a
2 changed files with 29 additions and 1 deletions

View File

@@ -894,6 +894,31 @@ namespace CliFx.Tests
});
}
[Fact]
public void Scalar_properties_annotated_as_parameter_requires_input()
{
// Arrange
var input = new CommandInputBuilder()
.Build();
// Act & assert
var ex = Assert.Throws<CliFxException>(() => CommandHelper.ResolveCommand<ParametersCommand>(input));
_output.WriteLine(ex.Message);
}
[Fact]
public void NonScalar_properties_annotated_as_parameter_requires_input()
{
// Arrange
var input = new CommandInputBuilder()
.AddParameter("foo")
.AddParameter("bar")
.Build();
var ex = Assert.Throws<CliFxException>(() => CommandHelper.ResolveCommand<ParametersCommand>(input));
_output.WriteLine(ex.Message);
}
[Fact]
public void Property_annotated_as_parameter_must_always_be_bound_to_some_value()
{