Skip to content

Commit

Permalink
Add test to make sure parser can detect explicit interface implementa…
Browse files Browse the repository at this point in the history
…tions
  • Loading branch information
pergardebrink committed Mar 8, 2020
1 parent 2896eac commit 924721e
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/CommandLine.Tests/Unit/Issue591ests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System.Linq;
using CommandLine.Tests.Fakes;
using CommandLine.Text;
using FluentAssertions;
using Xunit;
using Xunit.Abstractions;

//Issue #591
//When options class is only having explicit interface declarations, it should be detected as mutable.

namespace CommandLine.Tests.Unit
{
public class Issue591ests
{
[Fact]
public void Parse_option_with_only_explicit_interface_implementation()
{
string actual = string.Empty;

var arguments = new[] { "--inputfile", "file2.txt" };
var result = Parser.Default.ParseArguments<Options_With_Only_Explicit_Interface>(arguments);
result.WithParsed(options => {
actual = ((IInterface_With_Two_Scalar_Options)options).InputFile;
});

actual.Should().Be("file2.txt");
}
}
}

0 comments on commit 924721e

Please sign in to comment.