質問

I've been using approval-tests for a while with the WinMergeReporter and it is working well with the standard NUnit runner executable.

I am trying out NCrunch and the approval.Verify fails (as expected) for a new approval.

However, WinMerge does not startup.

I get the failure

ApprovalTests.Core.Exceptions.ApprovalMissingException : Failed Approval: Approval File "...\mytest.approved.txt" Not Found. at ApprovalTests.Approvers.FileApprover.Fail()

I can run the same code in the NUnit runner and WinMerge starts up.

What's the secret sauce for NCrunch to bring up the WinMergeReporter?

役に立ちましたか?

解決

This is actually by design, as having winmerge pop up every time NCrunch fails gets very annoying very quickly. Especially as it steals focus.

However, here's why it works and how to change it, if you so desire (you can always change it back)

Approval Tests has a MultiReporter system it uses that Front Loads from the assembly to implement the GangOfFour "Chain of Responsibility" pattern. It will act as if there is a

[assembly: FrontLoadedReporter(typeof(NCrunchReporter))]

This does not actually have to be there. Approval Tests will assume it as the default if nothing is actual present.

So if you wanted to turn it off you could just do

[assembly: FrontLoadedReporter(typeof(AlwaysFaillingReporter))]

Except that reporter doesn't exist (although it would be trivial to make one :-) So you might just want to do

[assembly: FrontLoadedReporter(typeof(WinMergeReporter))]

Happy testing!

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top