approvals/ApprovalTests.Net

Verify using xUnit fails

duszekmestre opened this issue · 1 comments

Package version: ApprovalTests 5.9.0
xUnit version: xunit 2.6.2, xunit.runner.visualstudio 2.5.4

Exception: System.InvalidOperationException : Late bound operations cannot be performed on types or methods for which ContainsGenericParameters is true.

Stack trace:

at System.Reflection.RuntimeMethodInfo.ThrowNoInvokeException()
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
[at ApprovalTests.Reporters.TestFrameworks.XUnit2Reporter.InvokeEqualsMethod(Type type, String[] parameters) in C:\projects\approvaltests-net\src\ApprovalTests\Reporters\TestFrameworks\XUnit2Reporter.cs:line 33](https://rralm.visualstudio.com/Civil-IT-and-Digital-Products/_git/ec3ce5a9-1521-44ad-a91a-fb38d567bae0?path=%2Fsrc%2FApprovalTests%2FReporters%2FTestFrameworks%2FXUnit2Reporter.cs&version=GBfeature%2F107982-e2e-pipeline&_a=contents&line=33&lineEnd=34&lineStartColumn=1&lineEndColumn=1&lineStyle=plain)
[at ApprovalTests.Reporters.TestFrameworks.AssertReporter.AssertEqual(String approvedContent, String receivedContent) in C:\projects\approvaltests-net\src\ApprovalTests\Reporters\TestFrameworks\AssertReporter.cs:line 46](https://rralm.visualstudio.com/Civil-IT-and-Digital-Products/_git/ec3ce5a9-1521-44ad-a91a-fb38d567bae0?path=%2Fsrc%2FApprovalTests%2FReporters%2FTestFrameworks%2FAssertReporter.cs&version=GBfeature%2F107982-e2e-pipeline&_a=contents&line=46&lineEnd=47&lineStartColumn=1&lineEndColumn=1&lineStyle=plain)
[at ApprovalTests.Reporters.TestFrameworks.AssertReporter.AssertFileContents(String approved, String received) in C:\projects\approvaltests-net\src\ApprovalTests\Reporters\TestFrameworks\AssertReporter.cs:line 37](https://rralm.visualstudio.com/Civil-IT-and-Digital-Products/_git/ec3ce5a9-1521-44ad-a91a-fb38d567bae0?path=%2Fsrc%2FApprovalTests%2FReporters%2FTestFrameworks%2FAssertReporter.cs&version=GBfeature%2F107982-e2e-pipeline&_a=contents&line=37&lineEnd=38&lineStartColumn=1&lineEndColumn=1&lineStyle=plain)
[at ApprovalTests.Reporters.TestFrameworks.AssertReporter.Report(String approved, String received) in C:\projects\approvaltests-net\src\ApprovalTests\Reporters\TestFrameworks\AssertReporter.cs:line 22](https://rralm.visualstudio.com/Civil-IT-and-Digital-Products/_git/ec3ce5a9-1521-44ad-a91a-fb38d567bae0?path=%2Fsrc%2FApprovalTests%2FReporters%2FTestFrameworks%2FAssertReporter.cs&version=GBfeature%2F107982-e2e-pipeline&_a=contents&line=22&lineEnd=23&lineStartColumn=1&lineEndColumn=1&lineStyle=plain)
[at ApprovalTests.Reporters.FirstWorkingReporter.Report(String approved, String received) in C:\projects\approvaltests-net\src\ApprovalTests\Reporters\FirstWorkingReporter.cs:line 26](https://rralm.visualstudio.com/Civil-IT-and-Digital-Products/_git/ec3ce5a9-1521-44ad-a91a-fb38d567bae0?path=%2Fsrc%2FApprovalTests%2FReporters%2FFirstWorkingReporter.cs&version=GBfeature%2F107982-e2e-pipeline&_a=contents&line=26&lineEnd=27&lineStartColumn=1&lineEndColumn=1&lineStyle=plain)
[at ApprovalTests.Reporters.ContinuousIntegration.ContinuousDeliveryUtils.ReportOnServer(String approved, String received) in C:\projects\approvaltests-net\src\ApprovalTests\Reporters\ContinuousIntegration\ContinuousDeliveryUtils.cs:line 12](https://rralm.visualstudio.com/Civil-IT-and-Digital-Products/_git/ec3ce5a9-1521-44ad-a91a-fb38d567bae0?path=%2Fsrc%2FApprovalTests%2FReporters%2FContinuousIntegration%2FContinuousDeliveryUtils.cs&version=GBfeature%2F107982-e2e-pipeline&_a=contents&line=12&lineEnd=13&lineStartColumn=1&lineEndColumn=1&lineStyle=plain)
[at ApprovalTests.Reporters.ContinuousIntegration.TfsVnextReporter.Report(String approved, String received) in C:\projects\approvaltests-net\src\ApprovalTests\Reporters\ContinuousIntegration\TfsVnextReporter.cs:line 10](https://rralm.visualstudio.com/Civil-IT-and-Digital-Products/_git/ec3ce5a9-1521-44ad-a91a-fb38d567bae0?path=%2Fsrc%2FApprovalTests%2FReporters%2FContinuousIntegration%2FTfsVnextReporter.cs&version=GBfeature%2F107982-e2e-pipeline&_a=contents&line=10&lineEnd=11&lineStartColumn=1&lineEndColumn=1&lineStyle=plain)
[at ApprovalTests.Reporters.FirstWorkingReporter.Report(String approved, String received) in C:\projects\approvaltests-net\src\ApprovalTests\Reporters\FirstWorkingReporter.cs:line 26](https://rralm.visualstudio.com/Civil-IT-and-Digital-Products/_git/ec3ce5a9-1521-44ad-a91a-fb38d567bae0?path=%2Fsrc%2FApprovalTests%2FReporters%2FFirstWorkingReporter.cs&version=GBfeature%2F107982-e2e-pipeline&_a=contents&line=26&lineEnd=27&lineStartColumn=1&lineEndColumn=1&lineStyle=plain)
[at ApprovalTests.Approvers.FileApprover.ReportFailure(IApprovalFailureReporter reporter) in C:\projects\approvaltests-net\src\ApprovalTests\Approvers\FileApprover.cs:line 63](https://rralm.visualstudio.com/Civil-IT-and-Digital-Products/_git/ec3ce5a9-1521-44ad-a91a-fb38d567bae0?path=%2Fsrc%2FApprovalTests%2FApprovers%2FFileApprover.cs&version=GBfeature%2F107982-e2e-pipeline&_a=contents&line=63&lineEnd=64&lineStartColumn=1&lineEndColumn=1&lineStyle=plain)
[at ApprovalTests.Core.Approver.Verify(IApprovalApprover approver, IApprovalFailureReporter reporter) in C:\projects\approvaltests-net\src\ApprovalTests\Core\Approver.cs:line 13](https://rralm.visualstudio.com/Civil-IT-and-Digital-Products/_git/ec3ce5a9-1521-44ad-a91a-fb38d567bae0?path=%2Fsrc%2FApprovalTests%2FCore%2FApprover.cs&version=GBfeature%2F107982-e2e-pipeline&_a=contents&line=13&lineEnd=14&lineStartColumn=1&lineEndColumn=1&lineStyle=plain)
[at ApprovalTests.Approvals.Verify(IApprovalApprover approver, IApprovalFailureReporter reporter) in C:\projects\approvaltests-net\src\ApprovalTests\Approvals.cs:line 58](https://rralm.visualstudio.com/Civil-IT-and-Digital-Products/_git/ec3ce5a9-1521-44ad-a91a-fb38d567bae0?path=%2Fsrc%2FApprovalTests%2FApprovals.cs&version=GBfeature%2F107982-e2e-pipeline&_a=contents&line=58&lineEnd=59&lineStartColumn=1&lineEndColumn=1&lineStyle=plain)
[at ApprovalTests.Approvals.Verify(IApprovalWriter writer, IApprovalNamer namer, IApprovalFailureReporter reporter) in C:\projects\approvaltests-net\src\ApprovalTests\Approvals.cs:line 45](https://rralm.visualstudio.com/Civil-IT-and-Digital-Products/_git/ec3ce5a9-1521-44ad-a91a-fb38d567bae0?path=%2Fsrc%2FApprovalTests%2FApprovals.cs&version=GBfeature%2F107982-e2e-pipeline&_a=contents&line=45&lineEnd=46&lineStartColumn=1&lineEndColumn=1&lineStyle=plain)
[at ApprovalTests.Approvals.Verify(IApprovalWriter writer) in C:\projects\approvaltests-net\src\ApprovalTests\Approvals.cs:line 104](https://rralm.visualstudio.com/Civil-IT-and-Digital-Products/_git/ec3ce5a9-1521-44ad-a91a-fb38d567bae0?path=%2Fsrc%2FApprovalTests%2FApprovals.cs&version=GBfeature%2F107982-e2e-pipeline&_a=contents&line=104&lineEnd=105&lineStartColumn=1&lineEndColumn=1&lineStyle=plain)
[at ApprovalTests.Approvals.VerifyWithExtension(String text, String fileExtensionWithDot, Func`2 scrubber) in C:\projects\approvaltests-net\src\ApprovalTests\Approvals.cs:line 151](https://rralm.visualstudio.com/Civil-IT-and-Digital-Products/_git/ec3ce5a9-1521-44ad-a91a-fb38d567bae0?path=%2Fsrc%2FApprovalTests%2FApprovals.cs&version=GBfeature%2F107982-e2e-pipeline&_a=contents&line=151&lineEnd=152&lineStartColumn=1&lineEndColumn=1&lineStyle=plain)

I guess problem exists here:
https://github.com/approvals/ApprovalTests.Net/blob/master/src/ApprovalTests/Reporters/TestFrameworks/XUnit2Reporter.cs#L32

XUnit has many overloads of method Equals and looking for method with 2 parameters is non deterministic. You should look for method with 2 parameters of type string

@SimonCropp thank you for fast fix. When new package version will be available to use?