Skip to content

Commit

Permalink
invoke methods as extension methods
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Dec 21, 2024
1 parent 5e4d216 commit cf00f53
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Adapter/MSTest.TestAdapter/Execution/TestMethodInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ private bool RunTestInitializeMethod(object classInstance, TestResult result)
// Prefix the exception message with the exception type name as prefix when exception is not assert exception.
string exceptionMessage = realException is UnitTestAssertException
? realException.TryGetMessage()
: ExceptionHelper.GetFormattedExceptionMessage(realException);
: realException.GetFormattedExceptionMessage();
string errorMessage = string.Format(
CultureInfo.CurrentCulture,
Resource.UTA_InitMethodThrows,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ private static UTF.UnitTestOutcome GetAggregateOutcome(List<TestResult> results)
UTF.UnitTestOutcome aggregateOutcome = results[0].Outcome;
foreach (TestResult result in results)
{
aggregateOutcome = UnitTestOutcomeExtensions.GetMoreImportantOutcome(aggregateOutcome, result.Outcome);
aggregateOutcome = aggregateOutcome.GetMoreImportantOutcome(result.Outcome);
}

return aggregateOutcome;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ namespace Microsoft.Testing.Platform.MSBuild;
public static class TestingPlatformBuilderHook
{
public static void AddExtensions(ITestApplicationBuilder testApplicationBuilder, string[] _)
=> MSBuildExtensions.AddMSBuild(testApplicationBuilder);
=> testApplicationBuilder.AddMSBuild();
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,25 +62,25 @@ public void ToUnitTestResultsForUnknownTestResultsConvertsToErrorUnitTestResults

public void GetMoreImportantOutcomeShouldReturnFailIfTwoOutcomesAreFailedAndInconclusive()
{
UTF.UnitTestOutcome resultOutcome = UnitTestOutcomeExtensions.GetMoreImportantOutcome(UTF.UnitTestOutcome.Failed, UTF.UnitTestOutcome.Inconclusive);
UTF.UnitTestOutcome resultOutcome = UTF.UnitTestOutcome.Failed.GetMoreImportantOutcome(UTF.UnitTestOutcome.Inconclusive);
Verify(resultOutcome == UTF.UnitTestOutcome.Failed);
}

public void GetMoreImportantOutcomeShouldReturnInconclusiveIfTwoOutcomesArePassedAndInconclusive()
{
UTF.UnitTestOutcome resultOutcome = UnitTestOutcomeExtensions.GetMoreImportantOutcome(UTF.UnitTestOutcome.Passed, UTF.UnitTestOutcome.Inconclusive);
UTF.UnitTestOutcome resultOutcome = UTF.UnitTestOutcome.Passed.GetMoreImportantOutcome(UTF.UnitTestOutcome.Inconclusive);
Verify(resultOutcome == UTF.UnitTestOutcome.Inconclusive);
}

public void GetMoreImportantOutcomeShouldReturnFailedIfTwoOutcomesArePassedAndFailed()
{
UTF.UnitTestOutcome resultOutcome = UnitTestOutcomeExtensions.GetMoreImportantOutcome(UTF.UnitTestOutcome.Passed, UTF.UnitTestOutcome.Failed);
UTF.UnitTestOutcome resultOutcome = UTF.UnitTestOutcome.Passed.GetMoreImportantOutcome(UTF.UnitTestOutcome.Failed);
Verify(resultOutcome == UTF.UnitTestOutcome.Failed);
}

public void GetMoreImportantOutcomeShouldReturnFailedIfBothOutcomesAreFailed()
{
UTF.UnitTestOutcome resultOutcome = UnitTestOutcomeExtensions.GetMoreImportantOutcome(UTF.UnitTestOutcome.Failed, UTF.UnitTestOutcome.Failed);
UTF.UnitTestOutcome resultOutcome = UTF.UnitTestOutcome.Failed.GetMoreImportantOutcome(UTF.UnitTestOutcome.Failed);
Verify(resultOutcome == UTF.UnitTestOutcome.Failed);
}
}

0 comments on commit cf00f53

Please sign in to comment.