Skip to content

Commit 00438a4

Browse files
author
Gurpreet Singh
committed
keep backward compatibilty for Humanize method
1 parent 4c23ca6 commit 00438a4

File tree

13 files changed

+20
-18
lines changed

13 files changed

+20
-18
lines changed

src/TestStack.BDDfy.Tests/Scanner/FluentScanner/BDDfyUsingFluentApi.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ public void WhenTitleIsNotProvidedItIsFetchedFromMethodName()
277277
.BDDfy();
278278

279279
var scenario = story.Scenarios.First();
280-
scenario.Title.ShouldBe(Configurator.Humanizer.Humanize(nameof(WhenTitleIsNotProvidedItIsFetchedFromMethodName)));
280+
scenario.Title.ShouldBe(Configurator.Humanize(nameof(WhenTitleIsNotProvidedItIsFetchedFromMethodName)));
281281
}
282282

283283
[Fact]

src/TestStack.BDDfy.Tests/Scanner/ReflectiveScanner/WhenCombinationOfExecutableAttributeAndMethodNamingConventionIsUsed.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,15 @@ public void LegacyConsecutiveAssertionStepIsScanned()
125125

126126
void VerifyStepAndItsProperties(Expression<Action> stepMethodAction, ExecutionOrder expectedOrder, int expectedCount = 1)
127127
{
128-
var matchingSteps = _scenario.Steps.Where(s => s.Title.Trim() == Configurator.Humanizer.Humanize(Helpers.GetMethodInfo(stepMethodAction).Name));
128+
var matchingSteps = _scenario.Steps.Where(s => s.Title.Trim() == Configurator.Humanize(Helpers.GetMethodInfo(stepMethodAction).Name));
129129
matchingSteps.Count().ShouldBe(expectedCount);
130130
matchingSteps.All(s => s.ExecutionOrder == expectedOrder).ShouldBe(true);
131131
}
132132

133133
[Fact]
134134
public void IgnoredMethodShouldNotBeAddedToSteps()
135135
{
136-
var matchingSteps = _scenario.Steps.Where(s => s.Title == Configurator.Humanizer.Humanize(Helpers.GetMethodInfo(() => _sut.ThenIAmNotAStep()).Name));
136+
var matchingSteps = _scenario.Steps.Where(s => s.Title == Configurator.Humanize(Helpers.GetMethodInfo(() => _sut.ThenIAmNotAStep()).Name));
137137
matchingSteps.ShouldBeEmpty();
138138
}
139139
}

src/TestStack.BDDfy.Tests/Scanner/ReflectiveScanner/WhenMethodNamesFollowNamingConventionsOtherThanGivenWhenThen.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public void IncorrectSpecificationStepIsNotAdded()
8989

9090
void AssertSpecificationStepIsScannedProperly(Expression<Action> getSpecMethod)
9191
{
92-
var specMethods = _steps.Where(s => s.Title.Trim() == Configurator.Humanizer.Humanize(Helpers.GetMethodInfo(getSpecMethod).Name));
92+
var specMethods = _steps.Where(s => s.Title.Trim() == Configurator.Humanize(Helpers.GetMethodInfo(getSpecMethod).Name));
9393
specMethods.Count().ShouldBe(1);
9494
var specStep = specMethods.First();
9595
specStep.Asserts.ShouldBe(false);

src/TestStack.BDDfy.Tests/Scanner/ReflectiveScanner/WhenStepsAreDefinedInABaseClass.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ Scenario Scenario
4141
[RunStepWithArgs("ThenInTheBaseClass")]
4242
void ThenTheFollowingStepFromBaseClassIsScanned(string stepName)
4343
{
44-
Scenario.Steps.Count(s => s.Title == Configurator.Humanizer.Humanize(stepName)).ShouldBe(1);
44+
Scenario.Steps.Count(s => s.Title == Configurator.Humanize(stepName)).ShouldBe(1);
4545
}
4646

4747
[RunStepWithArgs("GivenInTheSubClass")]
4848
[RunStepWithArgs("WhenInTheSubClass")]
4949
[RunStepWithArgs("ThenInTheSubClass")]
5050
void ThenTheFollowingStepFromSubClassScanned(string stepName)
5151
{
52-
Scenario.Steps.Count(s => s.Title == Configurator.Humanizer.Humanize(stepName)).ShouldBe(1);
52+
Scenario.Steps.Count(s => s.Title == Configurator.Humanize(stepName)).ShouldBe(1);
5353
}
5454

5555
[Fact]

src/TestStack.BDDfy.Tests/Scanner/ReflectiveScanner/WhenTestClassUsesExecutableAttributes.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public WhenTestClassUsesExecutableAttributes()
6868

6969
private static string GetStepTextFromMethodName(Expression<Action> methodInfoAction)
7070
{
71-
return Configurator.Humanizer.Humanize(Helpers.GetMethodInfo(methodInfoAction).Name);
71+
return Configurator.Humanize(Helpers.GetMethodInfo(methodInfoAction).Name);
7272
}
7373

7474
[Fact]

src/TestStack.BDDfy/Abstractions/DefaultStepTitleFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public StepTitle Create(
2828
includeInputsInStepTitle = titleAttribute.IncludeInputsInStepTitle.Value;
2929
}
3030

31-
var stepTitle = AppendPrefix(Configurator.Humanizer.Humanize(name), stepPrefix);
31+
var stepTitle = AppendPrefix(Configurator.Humanize(name), stepPrefix);
3232

3333
if (!string.IsNullOrEmpty(stepTextTemplate)) stepTitle = string.Format(stepTextTemplate, flatInputArray);
3434
else if (includeInputsInStepTitle)

src/TestStack.BDDfy/BDDfyExtensions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public static Story BDDfy(
2020
string caller = null)
2121
{
2222
var callerName = testObject.GetActualCallerName(caller);
23-
return InternalLazyBDDfy(testObject, scenarioTitle ?? Configurator.Humanizer.Humanize(callerName)).Run();
23+
return InternalLazyBDDfy(testObject, scenarioTitle ?? Configurator.Humanize(callerName)).Run();
2424
}
2525

2626
public static Engine LazyBDDfy(
@@ -30,7 +30,7 @@ public static Engine LazyBDDfy(
3030
string caller = null)
3131
{
3232
var callerName = testObject.GetActualCallerName(caller);
33-
return InternalLazyBDDfy(testObject, scenarioTitle ?? Configurator.Humanizer.Humanize(callerName));
33+
return InternalLazyBDDfy(testObject, scenarioTitle ?? Configurator.Humanize(callerName));
3434
}
3535

3636
/// <summary>
@@ -49,7 +49,7 @@ public static Story BDDfy<TStory>(
4949
where TStory : class
5050
{
5151
var callerName = testObject.GetActualCallerName(caller);
52-
return InternalLazyBDDfy(testObject, scenarioTitle ?? Configurator.Humanizer.Humanize(callerName), typeof(TStory)).Run();
52+
return InternalLazyBDDfy(testObject, scenarioTitle ?? Configurator.Humanize(callerName), typeof(TStory)).Run();
5353
}
5454

5555
public static Engine LazyBDDfy<TStory>(
@@ -60,7 +60,7 @@ public static Engine LazyBDDfy<TStory>(
6060
where TStory : class
6161
{
6262
var callerName = testObject.GetActualCallerName(caller);
63-
return InternalLazyBDDfy(testObject, scenarioTitle ?? Configurator.Humanizer.Humanize(callerName), typeof(TStory));
63+
return InternalLazyBDDfy(testObject, scenarioTitle ?? Configurator.Humanize(callerName), typeof(TStory));
6464
}
6565

6666
static Engine InternalLazyBDDfy(

src/TestStack.BDDfy/Configuration/Configurator.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,7 @@ public static class Configurator
2222
public static IFluentScannerFactory FluentScannerFactory { get; set; } = new DefaultFluentScannerFactory();
2323

2424
public static IStepTitleFactory StepTitleFactory { get; set; } = new DefaultStepTitleFactory();
25+
26+
public static string Humanize(string text) => Humanizer.Humanize(text);
2527
}
2628
}

src/TestStack.BDDfy/Reporters/TextReporter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ void ReportOnStep(Scenario scenario, Tuple<Step, string[]> stepAndLines, bool in
170170
}
171171

172172
var step = stepAndLines.Item1;
173-
var humanizedResult = Configurator.Humanizer.Humanize(step.Result.ToString());
173+
var humanizedResult = Configurator.Humanize(step.Result.ToString());
174174

175175
string message;
176176
if (scenario.Result == Result.Passed)

src/TestStack.BDDfy/Scanners/ScenarioScanners/ReflectiveScenarioScanner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public virtual IEnumerable<Scenario> Scan(ITestContext testContext)
4747

4848
static string GetScenarioText(Type scenarioType)
4949
{
50-
return Configurator.Humanizer.Humanize(scenarioType.Name);
50+
return Configurator.Humanize(scenarioType.Name);
5151
}
5252

5353
protected virtual IEnumerable<Step> ScanScenarioForSteps(ITestContext testContext)

0 commit comments

Comments
 (0)