The first time I popped open the solution after I did my ‘SharpMock’ spike, I was met with a surprise – the one test was failing! Surely I didn’t commit a cardinal sin and write a post about something that didn’t even work. It turns out I had been messing around with the OnMethodInvocationAspectOptions returned by overriding the GetOptions method of OnMethodInvocationAspect . Here’s the code that was in MockableAttribute : public override OnMethodInvocationAspectOptions GetOptions() { return OnMethodInvocationAspectOptions.WeaveSiteCall; } The original incarnation of Expect.Call(….) took a string to specify which method on which class to call, so the test passed with the above code. Now we have this syntax: Expect.Call(() => PersonDao.GetPerson(0), ryan); And the test doesn't pass. This means that if we want to have syntax like this (and we do!), we have to do the weaving in the class we’re calling. Much more importantly, if we want to preserve this syntax and not modif...
A blog about .NET development and pulling your hair out.