From 17fef5939019747fb5d764de752622dcd687848f Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Sat, 11 May 2024 20:31:40 +1000 Subject: [PATCH] "MSTest.TestAdapter" Version="3.3.1 --- src/ApprovalTests.MSTest/ApprovalTests.MSTest.csproj | 4 ++-- src/ApprovalTests.MSTest/MSTestReporterTest.cs | 4 ++-- .../Reporters/TestFrameworks/MsTestReporter.cs | 11 ++++++++--- src/Directory.Build.props | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/ApprovalTests.MSTest/ApprovalTests.MSTest.csproj b/src/ApprovalTests.MSTest/ApprovalTests.MSTest.csproj index 62a18682..85442cdb 100644 --- a/src/ApprovalTests.MSTest/ApprovalTests.MSTest.csproj +++ b/src/ApprovalTests.MSTest/ApprovalTests.MSTest.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/src/ApprovalTests.MSTest/MSTestReporterTest.cs b/src/ApprovalTests.MSTest/MSTestReporterTest.cs index ffbe9e3d..0a2e712a 100644 --- a/src/ApprovalTests.MSTest/MSTestReporterTest.cs +++ b/src/ApprovalTests.MSTest/MSTestReporterTest.cs @@ -12,9 +12,9 @@ public void TestReporter() Approvals.Verify("Hello"); Assert.Fail("Above verification should have thrown an AssertFailedException"); } - catch (Exception e) + catch (Exception exception) { - Assert.AreEqual("Assert.AreEqual failed. Expected:. Actual:. ", e.Message); + Assert.AreEqual("Assert.AreEqual failed. Expected:. Actual:. ", exception.Message); } } } \ No newline at end of file diff --git a/src/ApprovalTests/Reporters/TestFrameworks/MsTestReporter.cs b/src/ApprovalTests/Reporters/TestFrameworks/MsTestReporter.cs index c109c65c..617a22b0 100644 --- a/src/ApprovalTests/Reporters/TestFrameworks/MsTestReporter.cs +++ b/src/ApprovalTests/Reporters/TestFrameworks/MsTestReporter.cs @@ -13,9 +13,14 @@ protected override void InvokeEqualsMethod(Type type, string[] parameters) var bindingFlags = BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Static; var areEquals = type .GetMethods(bindingFlags) - .Single(_ => _.Name == "AreEqual" && - _.ContainsGenericParameters && - _.GetParameters().Length == 2); + .Single(_ => + { + var infos = _.GetParameters(); + return _.Name == "AreEqual" && + _.ContainsGenericParameters && + infos.Length == 2 && + infos.All(_ => !_.ParameterType.IsInterface); + }); var method = areEquals.MakeGenericMethod(typeof(string)); method.Invoke(null, parameters); } diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 15fce7f1..b5207345 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -3,7 +3,7 @@ preview CS1591;CA1416;SYSLIB0014 - 7.0.0-beta.2 + 7.0.0-beta.3 3.0 $(ProjectDir)..\ApprovalsKeyPair.snk true