Skip to content

Commit 28b41f8

Browse files
author
Per Gårdebrink
committed
Add test to make sure parser can detect explicit interface implementations
1 parent eba8845 commit 28b41f8

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using System.Linq;
2+
using CommandLine.Tests.Fakes;
3+
using CommandLine.Text;
4+
using FluentAssertions;
5+
using Xunit;
6+
using Xunit.Abstractions;
7+
8+
//Issue #591
9+
//When options class is only having explicit interface declarations, it should be detected as mutable.
10+
11+
namespace CommandLine.Tests.Unit
12+
{
13+
public class Issue591ests
14+
{
15+
[Fact]
16+
public void Parse_option_with_only_explicit_interface_implementation()
17+
{
18+
string actual = string.Empty;
19+
20+
var arguments = new[] { "--inputfile", "file2.txt" };
21+
var result = Parser.Default.ParseArguments<Options_With_Only_Explicit_Interface>(arguments);
22+
result.WithParsed(options => {
23+
actual = ((IInterface_With_Two_Scalar_Options)options).InputFile;
24+
});
25+
26+
actual.Should().Be("file2.txt");
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)