Skip to content

Commit 2102321

Browse files
committed
Changed AndInputsAreFormattedPropertlyInTheTitle_IsAConsecutiveAssertingStep to pass regardless of the computer locale - fixes issue#7
1 parent b2a3d1a commit 2102321

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

TestStack.BDDfy.Tests/FluentScanner/ScenarioToBeScannedUsingFluentScanner.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ namespace TestStack.BDDfy.Tests.FluentScanner
1111
[Story]
1212
class ScenarioToBeScannedUsingFluentScanner
1313
{
14+
internal const string InputDateStepTitleTemplate = "The provided date is {0:MMM d yyyy}";
15+
public static readonly DateTime InputDate = DateTime.Parse("2011-10-20", new CultureInfo("en-AU"));
16+
1417
private string[] _input1;
1518
private int[] _input2;
1619
private int _input3;
@@ -73,8 +76,6 @@ public void Dispose()
7376

7477
public static IEnumerable<ExecutionStep> GetSteps(ScenarioToBeScannedUsingFluentScanner testObject)
7578
{
76-
var inputDate = DateTime.Parse("2011-10-20", new CultureInfo("en-AU"));
77-
7879
var fluentScanner = testObject
7980
.Given(s => s.GivenSomeState(1, 2))
8081
.And(s => s.WhenSomeStepUsesIncompatibleNamingConvention())
@@ -86,7 +87,7 @@ public static IEnumerable<ExecutionStep> GetSteps(ScenarioToBeScannedUsingFluent
8687
.And(s => s.WhenSomethingHappens("other input"), false)
8788
.Then(s => s.ThenTheFollowingAssertionsShouldBeCorrect())
8889
.And(s => s.AndIncorrectAttributeWouldNotMatter())
89-
.And(s => s.ThenTitleFormatingWorksToo(inputDate), "The provided date is {0:MMM d yyyy}")
90+
.And(s => s.ThenTitleFormatingWorksToo(InputDate), InputDateStepTitleTemplate)
9091
.TearDownWith(s => s.Dispose());
9192

9293
return fluentScanner.GetScanner(null).Scan().Scenarios.SelectMany(s => s.Steps).ToList();

TestStack.BDDfy.Tests/FluentScanner/WhenStepsAreScannedUsingFluentScanner.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,11 @@ ExecutionStep AndInputsAreFormattedPropertlyInTheTitle
261261
{
262262
get
263263
{
264-
return _steps.Single(s => s.StepTitle.Trim() == "The provided date is Oct 20 2011");
264+
var formattedTitle = string.Format(
265+
ScenarioToBeScannedUsingFluentScanner.InputDateStepTitleTemplate,
266+
ScenarioToBeScannedUsingFluentScanner.InputDate);
267+
268+
return _steps.Single(s => s.StepTitle.Trim() == formattedTitle);
265269
}
266270
}
267271

0 commit comments

Comments
 (0)