private async Task RunTestSyncOrAsync(TestMethod testMethod, TestMethodAsync testMethodAsync, StsType stsType) { this.AppendText(string.Format("{0}: ", (testMethod != NullTestMethod) ? testMethod.Method.Name : testMethodAsync.Method.Name)); try { Sts sts = StsFactory.CreateSts(stsType); AdalTests.InitializeTest(); AdalTests.EndBrowserDialogSession(); if (testMethod != NullTestMethod) { testMethod(sts); } if (testMethodAsync != NullTestMethodAsync) { await testMethodAsync(sts); } this.AppendText("PASSED.\n", Color.Green); } catch (AssertFailedException) { this.AppendText("FAILED!\n", Color.Red); } catch (Exception ex) { this.AppendText(string.Format("FAILED with exception '{0}'!\n", ex), Color.Red); } }
private async Task RunTestAsync(TestMethodAsync testMethodAsync, StsType stsType = StsType.AAD) { await this.RunTestSyncOrAsync(NullTestMethod, testMethodAsync, stsType); }