diff --git a/CliFx.Tests.Dummy/CliFx.Tests.Dummy.csproj b/CliFx.Tests.Dummy/CliFx.Tests.Dummy.csproj
new file mode 100644
index 0000000..dfd8a43
--- /dev/null
+++ b/CliFx.Tests.Dummy/CliFx.Tests.Dummy.csproj
@@ -0,0 +1,13 @@
+
+
+
+
+ Exe
+ netcoreapp3.1
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CliFx.Tests.Dummy/Commands/HelloWorldCommand.cs b/CliFx.Tests.Dummy/Commands/HelloWorldCommand.cs
new file mode 100644
index 0000000..77e8b66
--- /dev/null
+++ b/CliFx.Tests.Dummy/Commands/HelloWorldCommand.cs
@@ -0,0 +1,19 @@
+using System.Threading.Tasks;
+using CliFx.Attributes;
+
+namespace CliFx.Tests.Dummy.Commands
+{
+ [Command]
+ public class HelloWorldCommand : ICommand
+ {
+ [CommandOption("target", EnvironmentVariableName = "ENV_TARGET")]
+ public string Target { get; set; } = "World";
+
+ public ValueTask ExecuteAsync(IConsole console)
+ {
+ console.Output.WriteLine($"Hello {Target}!");
+
+ return default;
+ }
+ }
+}
\ No newline at end of file
diff --git a/CliFx.Tests.Dummy/Program.cs b/CliFx.Tests.Dummy/Program.cs
new file mode 100644
index 0000000..7ab41e5
--- /dev/null
+++ b/CliFx.Tests.Dummy/Program.cs
@@ -0,0 +1,13 @@
+using System.Threading.Tasks;
+
+namespace CliFx.Tests.Dummy
+{
+ public class Program
+ {
+ public static async Task Main() =>
+ await new CliApplicationBuilder()
+ .AddCommandsFromThisAssembly()
+ .Build()
+ .RunAsync();
+ }
+}
\ No newline at end of file
diff --git a/CliFx.Tests/CliFx.Tests.csproj b/CliFx.Tests/CliFx.Tests.csproj
index bc03e41..ab5fc4e 100644
--- a/CliFx.Tests/CliFx.Tests.csproj
+++ b/CliFx.Tests/CliFx.Tests.csproj
@@ -11,6 +11,7 @@
+
@@ -19,7 +20,12 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/CliFx.Tests/DummyTests.cs b/CliFx.Tests/DummyTests.cs
new file mode 100644
index 0000000..a18a888
--- /dev/null
+++ b/CliFx.Tests/DummyTests.cs
@@ -0,0 +1,82 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Threading.Tasks;
+using CliWrap;
+using FluentAssertions;
+using NUnit.Framework;
+
+namespace CliFx.Tests
+{
+ [TestFixture]
+ public class DummyTests
+ {
+ private static Assembly DummyAssembly { get; } = typeof(Dummy.Program).Assembly;
+
+ private static IEnumerable GetTestCases_RunAsync()
+ {
+ yield return new TestCaseData(
+ new[] {"--version"},
+ new Dictionary(),
+ $"v{DummyAssembly.GetName().Version}"
+ );
+
+ yield return new TestCaseData(
+ new string[0],
+ new Dictionary(),
+ "Hello World!"
+ );
+
+ yield return new TestCaseData(
+ new[] {"--target", "Earth"},
+ new Dictionary(),
+ "Hello Earth!"
+ );
+
+ yield return new TestCaseData(
+ new string[0],
+ new Dictionary
+ {
+ ["ENV_TARGET"] = "Mars"
+ },
+ "Hello Mars!"
+ );
+
+ yield return new TestCaseData(
+ new[] {"--target", "Earth"},
+ new Dictionary
+ {
+ ["ENV_TARGET"] = "Mars"
+ },
+ "Hello Earth!"
+ );
+ }
+
+ [TestCaseSource(nameof(GetTestCases_RunAsync))]
+ public async Task RunAsync_Test(
+ IReadOnlyList arguments,
+ IReadOnlyDictionary environmentVariables,
+ string expectedStdOut)
+ {
+ // Arrange
+ var cli = Cli.Wrap("dotnet")
+ .SetArguments(arguments.Prepend(DummyAssembly.Location).ToArray())
+ .EnableExitCodeValidation()
+ .EnableStandardErrorValidation()
+ .SetStandardOutputCallback(Console.WriteLine)
+ .SetStandardErrorCallback(Console.WriteLine);
+
+ foreach (var (key, value) in environmentVariables)
+ cli.SetEnvironmentVariable(key, value);
+
+ // Act
+ var result = await cli.ExecuteAsync();
+
+ // Assert
+ result.ExitCode.Should().Be(0);
+ result.StandardError.Should().BeNullOrWhiteSpace();
+ result.StandardOutput.TrimEnd().Should().Be(expectedStdOut);
+ }
+ }
+}
\ No newline at end of file
diff --git a/CliFx.sln b/CliFx.sln
index 828c836..3ec063e 100644
--- a/CliFx.sln
+++ b/CliFx.sln
@@ -19,6 +19,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CliFx.Benchmarks", "CliFx.B
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CliFx.Demo", "CliFx.Demo\CliFx.Demo.csproj", "{AAB6844C-BF71-448F-A11B-89AEE459AB15}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CliFx.Tests.Dummy", "CliFx.Tests.Dummy\CliFx.Tests.Dummy.csproj", "{F717347D-8656-44DA-A4A2-BE515E8C4655}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -77,6 +79,18 @@ Global
{AAB6844C-BF71-448F-A11B-89AEE459AB15}.Release|x64.Build.0 = Release|Any CPU
{AAB6844C-BF71-448F-A11B-89AEE459AB15}.Release|x86.ActiveCfg = Release|Any CPU
{AAB6844C-BF71-448F-A11B-89AEE459AB15}.Release|x86.Build.0 = Release|Any CPU
+ {F717347D-8656-44DA-A4A2-BE515E8C4655}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F717347D-8656-44DA-A4A2-BE515E8C4655}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F717347D-8656-44DA-A4A2-BE515E8C4655}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {F717347D-8656-44DA-A4A2-BE515E8C4655}.Debug|x64.Build.0 = Debug|Any CPU
+ {F717347D-8656-44DA-A4A2-BE515E8C4655}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {F717347D-8656-44DA-A4A2-BE515E8C4655}.Debug|x86.Build.0 = Debug|Any CPU
+ {F717347D-8656-44DA-A4A2-BE515E8C4655}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F717347D-8656-44DA-A4A2-BE515E8C4655}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F717347D-8656-44DA-A4A2-BE515E8C4655}.Release|x64.ActiveCfg = Release|Any CPU
+ {F717347D-8656-44DA-A4A2-BE515E8C4655}.Release|x64.Build.0 = Release|Any CPU
+ {F717347D-8656-44DA-A4A2-BE515E8C4655}.Release|x86.ActiveCfg = Release|Any CPU
+ {F717347D-8656-44DA-A4A2-BE515E8C4655}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE