Commit 0ce5f899 authored by Tim Bureck's avatar Tim Bureck

* Fixed `InputDefinition` not accepting two options without shortcut

* Release v0.2.0-alpha2
parent eb321bc2
Pipeline #15 passed with stages
in 1 minute and 16 seconds
......@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.2.0-alpha2] - 2019-07-06
### Changed
- Fixed `InputDefinition` not accepting two options without shortcut
## [0.2.0-alpha1] - 2019-07-06
### Added
- Multiple Value Options
......
......@@ -62,7 +62,7 @@ namespace TBureck.Terminal.IO
throw new ArgumentException($"Option with name {option.Name} does already exist.");
}
if (this._options.FirstOrDefault(o => o.Shortcut == option.Shortcut) != null) {
if (option.Shortcut != null && this._options.FirstOrDefault(o => o.Shortcut == option.Shortcut) != null) {
throw new ArgumentException($"Option with shortcut {option.Shortcut} does already exist.");
}
......
......@@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>TBureck.Terminal</RootNamespace>
<PackageId>TBureck.Terminal</PackageId>
<PackageVersion>0.2.0-alpha1</PackageVersion>
<PackageVersion>0.2.0-alpha2</PackageVersion>
<Authors>Tim Bureck &lt;kontakt@tbureck.de&gt;</Authors>
<Description>A simple .NET terminal application framework</Description>
<PackageProjectUrl>https://git.tbureck.de/tbureck/terminal-app</PackageProjectUrl>
......
......@@ -136,6 +136,25 @@ namespace TBureck.Tests.Terminal.IO
});
}
[Fact]
public void AllowTwoOptionsWithEmptyShortcut()
{
InputDefinition inputDefinition = new InputDefinition();
InputOption fileOption = InputOption.Of("file");
InputOption folderOption = InputOption.Of("folder");
inputDefinition.AddOption(fileOption);
inputDefinition.AddOption(folderOption);
Assert.Equal(2, inputDefinition.OptionCount);
Assert.Collection(
inputDefinition.Options,
opt => Assert.Equal(fileOption, opt),
opt => Assert.Equal(folderOption, opt)
);
}
[Fact]
public void GetOptionByName()
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment