Skip to content

Commit

Permalink
SpecFlowOSS#2608: Await the call to FeatureBackgroundAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
laingsimon committed Oct 15, 2022
1 parent b3a131b commit 0f90e76
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,12 @@ internal void GenerateTestMethodBody(TestClassGenerationContext generationContex
{
using (new SourceLineScope(_specFlowConfiguration, _codeDomHelper, statementsWhenScenarioIsExecuted, generationContext.Document.SourceFilePath, generationContext.Feature.Background.Location))
{
statementsWhenScenarioIsExecuted.Add(new CodeExpressionStatement(
new CodeMethodInvokeExpression(
new CodeThisReferenceExpression(),
generationContext.FeatureBackgroundMethod.Name)));
var backgroundMethodCallExpression = new CodeMethodInvokeExpression(
new CodeThisReferenceExpression(),
generationContext.FeatureBackgroundMethod.Name);

_codeDomHelper.MarkCodeMethodInvokeExpressionAsAwait(backgroundMethodCallExpression);
statementsWhenScenarioIsExecuted.Add(new CodeExpressionStatement(backgroundMethodCallExpression));
}
}

Expand Down

0 comments on commit 0f90e76

Please sign in to comment.