ApprovalTests.Net icon indicating copy to clipboard operation
ApprovalTests.Net copied to clipboard

Implementations of IApprovalNamer should not have to call Aprovals.SetCaller()

Open raseesink opened this issue 11 years ago • 2 comments

Thank you for this great library!

While upgrading to the latest release i noticed an object reference error inside:

Verify(IApprovalWriter writer, IApprovalNamer namer, IApprovalFailureReporter reporter)

on the first line in this method. We have custom implementations of a namer, among others custom implementations.

The debugger showed currentCaller is not null, but its value is.

A workaround is calling

Aprovals.SetCaller()

before Aprovals.Verify but this was not what I expected as a library user, I believe this is a liskov substitution violation from SOLID.

Fortunatly the fix is quite simple. I have forked the project and made a failing test, and fixed this issue. Pull request is coming up

raseesink avatar Dec 01 '15 20:12 raseesink

Please fix!

sterkinternet avatar Jun 01 '16 14:06 sterkinternet

this was fixed in https://github.com/approvals/ApprovalTests.Net/pull/141

SimonCropp avatar Nov 11 '19 01:11 SimonCropp