forked from nspec/NSpec
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
161 additions
and
544 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System.Text.RegularExpressions; | ||
|
||
namespace NSpec.Domain | ||
{ | ||
public class DefaultConvention : Conventions | ||
{ | ||
public override void SpecifyConventions(ConventionSpecification specification) | ||
{ | ||
specification.SetBefore(new Regex("before_each|BeforeEach")); | ||
|
||
specification.SetAct(new Regex("act_each|ActEach")); | ||
|
||
specification.SetExample(new Regex("(^[iI]t[_A-Z])|(^[sS]pecify)")); | ||
|
||
specification.SetContext(new Regex("")); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
using NUnit.Framework; | ||
using NSpec.Domain; | ||
using NSpec; | ||
|
||
namespace NSpecSpecs | ||
{ | ||
public class describe_DefaultConvention | ||
{ | ||
protected Conventions underScore; | ||
|
||
[SetUp] | ||
public void setup_base() | ||
{ | ||
underScore = new DefaultConvention(); | ||
|
||
underScore.Initialize(); | ||
} | ||
} | ||
|
||
[TestFixture] | ||
[Category("DefaultConvention")] | ||
public class when_determining_before_methods : describe_DefaultConvention | ||
{ | ||
[Test] | ||
public void should_match_before_each() | ||
{ | ||
ShouldBeBefore("before_each"); | ||
} | ||
|
||
[Test] | ||
public void should_match_BeforeEach() | ||
{ | ||
ShouldBeBefore("BeforeEach"); | ||
} | ||
|
||
void ShouldBeBefore(string methodName) | ||
{ | ||
underScore.IsMethodLevelBefore(methodName).should_be_true(); | ||
|
||
underScore.IsMethodLevelContext(methodName).should_be_false(); | ||
} | ||
} | ||
|
||
[TestFixture] | ||
[Category("DefaultConvention")] | ||
public class when_determining_act_methods : describe_DefaultConvention | ||
{ | ||
[Test] | ||
public void should_match_act_each() | ||
{ | ||
ShouldBeAct("act_each"); | ||
} | ||
|
||
[Test] | ||
public void should_match_ActEach() | ||
{ | ||
ShouldBeAct("ActEach"); | ||
} | ||
|
||
void ShouldBeAct(string methodName) | ||
{ | ||
underScore.IsMethodLevelAct(methodName).should_be_true(); | ||
|
||
underScore.IsMethodLevelContext(methodName).should_be_false(); | ||
} | ||
} | ||
|
||
[TestFixture] | ||
[Category("DefaultConvention")] | ||
public class when_determining_example_methods : describe_DefaultConvention | ||
{ | ||
[Test] | ||
public void should_match_it() | ||
{ | ||
ShouldBeExample("it_should_be_true"); | ||
} | ||
|
||
[Test] | ||
public void should_match_specify() | ||
{ | ||
ShouldBeExample("specify_should_be_true"); | ||
} | ||
|
||
[Test] | ||
public void should_match_ItShouldBeTrue() | ||
{ | ||
ShouldBeExample("ItShouldBeTrue"); | ||
} | ||
|
||
[Test] | ||
public void should_match_SpecifyShouldBeTrue() | ||
{ | ||
ShouldBeExample("SpecifyShouldBeTrue"); | ||
} | ||
|
||
[Test] | ||
public void should_not_match_IterationShould() | ||
{ | ||
underScore.IsMethodLevelExample("IterationShould").should_be_false(); | ||
} | ||
|
||
void ShouldBeExample(string methodName) | ||
{ | ||
underScore.IsMethodLevelExample(methodName).should_be_true(); | ||
|
||
underScore.IsMethodLevelContext(methodName).should_be_false(); | ||
} | ||
} | ||
|
||
[TestFixture] | ||
[Category("DefaultConvention")] | ||
public class when_determining_context_methods : describe_DefaultConvention | ||
{ | ||
[Test] | ||
public void should_be_match_describe_a_specification() | ||
{ | ||
underScore.IsMethodLevelContext("describe_a_specification").should_be_true(); | ||
} | ||
|
||
[Test] | ||
public void should_be_match_DescribeASpecification() | ||
{ | ||
underScore.IsMethodLevelContext("DescribeASpecification").should_be_true(); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.