Or you can also use the Arg<T> syntax: mock.AssertWasNotCalled(x => x.Delete(Arg<string>.is.Anything));
On 17 February 2010 21:36, Jeff Greenland <[email protected]> wrote: > Awesome! I knew it'd be simple! Thanks! > > > > On Wed, Feb 17, 2010 at 2:32 PM, Chris Missal <[email protected]>wrote: > >> Sure, use it like this: >> >> mock.AssertWasNotCalled(x => x.Delete("test"), y => y.IgnoreArguments()); >> >> hope that helps. >> >> >> On Wed, Feb 17, 2010 at 3:02 PM, Hegg <[email protected]> wrote: >> >>> Greetings, >>> >>> I have been building some tests and thought I'd try out the new >>> "AssertWasNotCalled" extension method. It seems to work as I'd expect >>> on methods with no parameters, but when I have a method with a >>> parameter, I can't seem to find a way to have it ignore those >>> parameters - that is, I want to assert that a specific method was >>> never called with any parameter ever. >>> >>> For example, I'm using a interface which has a .List() method and >>> a .Delete(string name) method. Using the AAA style syntax, my test >>> uses AssertWasCalled(x => x.List()) and then attempts to >>> AssertWasNotCalled(x => x.Delete("test")). Since my code was awesome, >>> it succeeded, but I also like to "break" my methods sometimes just to >>> be sure I wrote a test correctly. I added a call to >>> the .Delete("test") in the method and the test now fails as expected. >>> However, if I change to .Delete("any other text"), the test passes >>> because "any other text" does not equal "test". Essentially I want to >>> ensure that the .Delete() method was never called, regardless of >>> parameters. >>> >>> Is there a way to IgnoreArguments() on the AssertWasNotCalled() >>> somehow, or would I be looking at making a strict mock (and >>> consequently setting up expectations on every method call)? >>> >>> Just more of a "how do I" question than anything. :) >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Rhino.Mocks" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]<rhinomocks%[email protected]> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/rhinomocks?hl=en. >>> >>> >> >> >> -- >> Chris Missal >> http://chrismissal.lostechies.com/ >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Rhino.Mocks" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]<rhinomocks%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/rhinomocks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Rhino.Mocks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<rhinomocks%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/rhinomocks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Rhino.Mocks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rhinomocks?hl=en.
