Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
added integration tests to fix binding bug
- Loading branch information
1 parent
05de136
commit d2fe989
Showing
7 changed files
with
118 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
using GoCommando.Api; | ||
using GoCommando.Attributes; | ||
using NUnit.Framework; | ||
using DescriptionAttribute = NUnit.Framework.DescriptionAttribute; | ||
|
||
namespace GoCommando.Tests.Integration | ||
{ | ||
[TestFixture] | ||
public class ErrorTestCases | ||
{ | ||
[SetUp] | ||
public void SetUp() | ||
{ | ||
CommandoWithTwoArguments.SomePathStatic = null; | ||
CommandoWithTwoArguments.AnotherPathStatic = null; | ||
} | ||
|
||
[Test, Description("This error was due to named argument syntax using slash, thus resulting in arguments with forward slash (e.g. an URL) being interpreted as such")] | ||
public void ReproduceError() | ||
{ | ||
var errorCode = Go.Run<CommandoWithTwoArguments>(new[] {"/src/somepath", "/src/anotherpath"}); | ||
|
||
Assert.AreEqual(0, errorCode); | ||
Assert.AreEqual("/src/somepath", CommandoWithTwoArguments.SomePathStatic); | ||
Assert.AreEqual("/src/anotherpath", CommandoWithTwoArguments.AnotherPathStatic); | ||
} | ||
|
||
class CommandoWithTwoArguments : ICommando | ||
{ | ||
[PositionalArgument] | ||
public string SomePath { get; set; } | ||
|
||
[PositionalArgument] | ||
public string AnotherPath { get; set; } | ||
|
||
public void Run() | ||
{ | ||
SomePathStatic = SomePath; | ||
AnotherPathStatic = AnotherPath; | ||
} | ||
|
||
public static string SomePathStatic { get; set; } | ||
public static string AnotherPathStatic { get; set; } | ||
} | ||
|
||
[Test, Description("This was the actual parameters resulting in an error")] | ||
public void HowAboutThis() | ||
{ | ||
var errorCode = Go.Run<CommandoWithThreeArguments>(new[] | ||
{ | ||
@"src\Noder.Test\bin\Debug\Noder.Test.dll", | ||
@"src\Noder.Test\Features\00_basics.feature" | ||
}); | ||
|
||
Assert.AreEqual(0, errorCode); | ||
Assert.AreEqual(@"src\Noder.Test\bin\Debug\Noder.Test.dll", CommandoWithThreeArguments.SomePathStatic); | ||
Assert.AreEqual(@"src\Noder.Test\Features\00_basics.feature", CommandoWithThreeArguments.AnotherPathStatic); | ||
Assert.IsFalse(CommandoWithThreeArguments.SomeFlagStatic); | ||
} | ||
|
||
class CommandoWithThreeArguments : ICommando | ||
{ | ||
[PositionalArgument] | ||
public string SomePath { get; set; } | ||
|
||
[PositionalArgument] | ||
public string AnotherPath { get; set; } | ||
|
||
[NamedArgument("flag", "f")] | ||
public bool SomeFlag { get; set; } | ||
|
||
public void Run() | ||
{ | ||
SomePathStatic = SomePath; | ||
AnotherPathStatic = AnotherPath; | ||
SomeFlagStatic = SomeFlag; | ||
} | ||
|
||
public static string SomePathStatic { get; set; } | ||
public static string AnotherPathStatic { get; set; } | ||
public static bool SomeFlagStatic { get; set; } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters