Add support for directives (debug and preview)

Closes #7
Closes #8
This commit is contained in:
Alexey Golub
2019-08-24 18:22:54 +03:00
parent e4a502d9d6
commit 80bf477f3b
11 changed files with 233 additions and 34 deletions

View File

@@ -26,7 +26,7 @@ namespace CliFx.Tests
);
}
private static IEnumerable<TestCaseData> GetTestCases_HelpAndVersion_RunAsync()
private static IEnumerable<TestCaseData> GetTestCases_RunAsync_Smoke()
{
yield return new TestCaseData(
new[] {typeof(DefaultCommand)},
@@ -53,6 +53,21 @@ namespace CliFx.Tests
new string[0]
);
yield return new TestCaseData(
new[] {typeof(NamedCommand)},
new[] {"-h"}
);
yield return new TestCaseData(
new[] {typeof(NamedCommand)},
new[] {"--help"}
);
yield return new TestCaseData(
new[] {typeof(NamedCommand)},
new[] {"--version"}
);
yield return new TestCaseData(
new[] {typeof(NamedCommand)},
new[] {"cmd", "-h"}
@@ -72,6 +87,21 @@ namespace CliFx.Tests
new[] {typeof(FaultyCommand3)},
new[] {"faulty3", "-h"}
);
yield return new TestCaseData(
new[] {typeof(DefaultCommand)},
new[] {"[preview]"}
);
yield return new TestCaseData(
new[] {typeof(FaultyCommand1)},
new[] {"faulty1", "[preview]"}
);
yield return new TestCaseData(
new[] {typeof(FaultyCommand1)},
new[] {"faulty1", "[preview]", "-o", "value"}
);
}
private static IEnumerable<TestCaseData> GetTestCases_RunAsync_Negative()
@@ -126,8 +156,8 @@ namespace CliFx.Tests
}
[Test]
[TestCaseSource(nameof(GetTestCases_HelpAndVersion_RunAsync))]
public async Task RunAsync_HelpAndVersion_Test(IReadOnlyList<Type> commandTypes, IReadOnlyList<string> commandLineArguments)
[TestCaseSource(nameof(GetTestCases_RunAsync_Smoke))]
public async Task RunAsync_Smoke_Test(IReadOnlyList<Type> commandTypes, IReadOnlyList<string> commandLineArguments)
{
// Arrange
using (var stdout = new StringWriter())