/// <summary> /// Defines that an error occured during the NUnit test execution should be added to the log upon the clean up. /// </summary> /// <param name="builder">The builder.</param> /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns> public static AtataContextBuilder LogNUnitError(this AtataContextBuilder builder) { return(builder.OnCleanUp(() => { dynamic testContext = GetNUnitTestContext(); var testResult = testContext.Result; if ((bool)testResult.Outcome.Status.ToString().Contains("Fail")) { AtataContext.Current.Log.Error((string)testResult.Message, (string)testResult.StackTrace); } })); }