I believe it's: var args = mockFoo.GetArgumentsForCallsMadeOn(m => m.DoSomething(null));
args[0] will be an array of arguments passed the 1st time DoSomething is called. args[1] will be an array of arguments passed the 2nd time DoSomething is called. etc... So in your case, you should be able to verify that args[0][0].ToString() == "hello world" --- Patrick Steele http://weblogs.asp.net/psteele On Wed, Mar 17, 2010 at 3:28 PM, Dave <[email protected]> wrote: > If I have a method on a mock object that takes an argument and I want > to inspect that argument after invoking my test method, how do I do > that? For example, > > class Foo : IFoo { > public void DoSomething(String argument) { > <do something with argument> > } > } > > class Bar { > public IFoo Foo {get; set;} > > public void MethodUnderTest() { > Foo.DoSomething("hello world"); > } > } > > In this case, I'm testing class Bar but I want to make sure that > "MethodUnderTest" passes "Hello World" to Foo. > If I create a mock IFoo, what would I have to do to get the mock to > capture the argument and save it so that I can assert against it in my > test? > > -- > 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. > > -- 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.
