Skip to content

Commit

Permalink
unit test for array argument
Browse files Browse the repository at this point in the history
  • Loading branch information
neuecc committed Oct 5, 2022
1 parent 57240a5 commit 815cad8
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions tests/ConsoleAppFramework.Tests/Integration/SingleCommandTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,48 @@ public void NoOptions_NoArgs()
console.Output.Should().Contain("HelloMyWorld");
}

[Fact]
public void IntArguments()
{
using var console = new CaptureConsoleOutput();

var args = "--foo 1,2,3".Split(' ');

ConsoleApp.RunAsync(args, (string[] foo) =>
{
foreach (var item in foo)
{
Console.WriteLine(item);
}
});

console.Output.Should().Be(@"1
2
3
");
}

[Fact]
public void StringArguments()
{
using var console = new CaptureConsoleOutput();

var args = "--foo a,b,c".Split(' ');

ConsoleApp.RunAsync(args, (string[] foo) =>
{
foreach (var item in foo)
{
Console.WriteLine(item);
}
});

console.Output.Should().Be(@"a
b
c
");
}

public class CommandTests_Single_NoOptions_NoArgs : ConsoleAppBase
{
public void Hello() => Console.WriteLine("HelloMyWorld");
Expand Down

0 comments on commit 815cad8

Please sign in to comment.