From 09abb08860fb45182337a6daf89a81bf0ff5a6cb Mon Sep 17 00:00:00 2001 From: Maksim Stepanov <17935127+delatrie@users.noreply.github.com> Date: Wed, 11 Oct 2023 02:22:08 +0700 Subject: [PATCH] Add async suffix to private step methods This helps to make distinction more clear to a reader. --- Allure.Net.Commons/Steps/CoreStepsHelper.cs | 52 ++++++++++----------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/Allure.Net.Commons/Steps/CoreStepsHelper.cs b/Allure.Net.Commons/Steps/CoreStepsHelper.cs index 64f2bc7d..46951c07 100644 --- a/Allure.Net.Commons/Steps/CoreStepsHelper.cs +++ b/Allure.Net.Commons/Steps/CoreStepsHelper.cs @@ -148,11 +148,8 @@ public static void UpdateTestResult(Action update) => #endregion - public static async Task Step(string name, Func> action) => - await ExecuteStep(name, action); - - public static T Step(string name, Func action) => - ExecuteStep(name, action); + public static void Step(string name) => + Step(name, () => { }); public static void Step(string name, Action action) { @@ -163,21 +160,18 @@ public static void Step(string name, Action action) }); } + public static T Step(string name, Func action) => + ExecuteStep(name, action); + public static async Task Step(string name, Func action) => - await ExecuteStep(name, async () => + await ExecuteStepAsync(name, async () => { await action(); return Task.FromResult(null); }); - public static void Step(string name) => - Step(name, () => { }); - - public static async Task Before(string name, Func> action) => - await ExecuteFixture(name, StartBeforeFixture, action); - - public static T Before(string name, Func action) => - ExecuteFixture(name, StartBeforeFixture, action); + public static async Task Step(string name, Func> action) => + await ExecuteStepAsync(name, action); public static void Before(string name, Action action) => Before(name, () => @@ -186,18 +180,18 @@ public static void Before(string name, Action action) => return null as object; }); + public static T Before(string name, Func action) => + ExecuteFixture(name, StartBeforeFixture, action); + public static async Task Before(string name, Func action) => - await ExecuteFixture(name, StartBeforeFixture, async () => + await ExecuteFixtureAsync(name, StartBeforeFixture, async () => { await action(); return Task.FromResult(null); }); - public static async Task After(string name, Func> action) => - await ExecuteFixture(name, StartAfterFixture, action); - - public static T After(string name, Func action) => - ExecuteFixture(name, StartAfterFixture, action); + public static async Task Before(string name, Func> action) => + await ExecuteFixtureAsync(name, StartBeforeFixture, action); public static void After(string name, Action action) => After(name, () => @@ -206,13 +200,19 @@ public static void After(string name, Action action) => return null as object; }); + public static T After(string name, Func action) => + ExecuteFixture(name, StartAfterFixture, action); + public static async Task After(string name, Func action) => - await ExecuteFixture(name, StartAfterFixture, async () => + await ExecuteFixtureAsync(name, StartAfterFixture, async () => { await action(); return Task.FromResult(null); }); + public static async Task After(string name, Func> action) => + await ExecuteFixtureAsync(name, StartAfterFixture, action); + static T ExecuteStep(string name, Func action) => ExecuteAction( name, @@ -222,11 +222,11 @@ static T ExecuteStep(string name, Func action) => FailStep ); - static async Task ExecuteStep( + static async Task ExecuteStepAsync( string name, Func> action ) => - await ExecuteAction( + await ExecuteActionAsync( () => StartStep(name), action, PassStep, @@ -246,19 +246,19 @@ Func action FailFixture ); - static async Task ExecuteFixture( + static async Task ExecuteFixtureAsync( string name, Action startFixture, Func> action ) => - await ExecuteAction( + await ExecuteActionAsync( () => startFixture(name), action, PassFixture, FailFixture ); - private static async Task ExecuteAction( + private static async Task ExecuteActionAsync( Action start, Func> action, Action pass,