|
From: Nat P. <nat...@gm...> - 2006-03-02 18:39:49
|
You can extend the NMock syntax in several places. 1) Just write a method in the test fixture class. Quick and easy, but you the syntax looks a little different from the other constraints and you can't share factory methods among tests. 2) Create your own Is class derived from NMock2.Is and add your own factory methods in there. --Nat. On 3/2/06, Mike Mason <mik...@gm...> wrote: > On 3/2/06, Nat Pryce <nat...@gm...> wrote: > > > The latter. In the final example you show the use of "new" in an > > expectation. We've tried to make that be considered bad style in > > jMock and always show using a factory function so that tests are > > expressive. It's not always caught on but more people use factory > > functions than not. > > > > The jMock docs have this page: > http://jmock.codehaus.org/custom-constraints.html > > At the end of the page they suggest making a factory method by extending = the > base TestCase class provided by jMock, but this isn't how NMock 2 works. = I'm > not sure how an end-user can add a syntactically nice looking factory > method. > > I'm sorry to be dim, I guess what I'm asking for is a code sample. > > Cheers, > Mike. > > > |