Skip to content

Commit

Permalink
#2608: Await the call to FeatureBackgroundAsync (#2654)
Browse files Browse the repository at this point in the history
  • Loading branch information
laingsimon authored Oct 24, 2022
1 parent 8d58ac0 commit 631a2d5
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 631a2d5

Please sign in to comment.