Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding test for CmdCommando

  • Loading branch information...
commit 5f4539afec308689ef41e6382c3f17374bd66909 1 parent 4146ce2
@manojlds authored
View
38 src/cmd.UnitTests/Commands/CmdCommandoTests.cs
@@ -0,0 +1,38 @@
+using Moq;
+using NUnit.Framework;
+using cmd.Commands;
+using cmd.Runner;
+
+namespace cmd.UnitTests.Commands
+{
+ [TestFixture]
+ public class CmdCommandoTests
+ {
+ private Mock<IRunner> mockRunner;
+ private dynamic cmd;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mockRunner = new Mock<IRunner>();
+ mockRunner.Setup(runner => runner.GetCommand()).Returns(new CmdCommando(mockRunner.Object));
+ cmd = new Cmd(mockRunner.Object);
+ }
+
+ [Test]
+ public void ShouldRunTheCommandAgainstCmd()
+ {
+ IRunOptions expectedRunOptions = null;
+ mockRunner.Setup(runner => runner.Run(It.IsAny<IRunOptions>())).Callback<IRunOptions>(options =>
+ {
+ expectedRunOptions
+ = options;
+ });
+
+ cmd.dir();
+
+ Assert.That(expectedRunOptions.Command, Is.EqualTo("cmd"));
+ Assert.That(expectedRunOptions.Arguments, Is.EqualTo("/c dir"));
+ }
+ }
+}
View
1  src/cmd.UnitTests/cmd.UnitTests.csproj
@@ -47,6 +47,7 @@
<ItemGroup>
<Compile Include="CmdDSLTests.cs" />
<Compile Include="CmdTests.cs" />
+ <Compile Include="Commands\CmdCommandoTests.cs" />
<Compile Include="Commands\CommandoTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Runner\Arguments\ArgumentBuilderTests.cs" />
Please sign in to comment.
Something went wrong with that request. Please try again.