ploeh/ploeh.github.com — pull request #32 by Lumirris (2013-08-22 22:18:56+00:00)
Title: Add comment regarding test parameter order being sometimes critical with...

... frozen SUT dependencies

Comment text:
Forgive me if I missed this point in your blog, but it seems that the parameter order is critical when injecting objects marked with the [Frozen] attribute into your test, if the SUT is being injected with that frozen object.

I was refactoring my tests to make use of AutoData like you've shown here, and was adding my [Frozen]Mock parameter willy-nilly to the end of the test parameters, *after* the SUT parameter. I was freezing it so that I could verify the same mocked dependency that was injected into the SUT as part of my test… or so I thought.

void MySutTest(MySut sut, [Frozen]Mock frozen)

After a brief episode of confusion and self-loathing, I moved the frozen mocked dependency in front of the SUT in the test parameter list. Skies parted, angels sang, test passed again.

void MySutTest([Frozen]Mock frozen, MySut sut)