Also related, but mostly a side question, is can I make the Accessor a mock
accessor and still AttachShadow(foo) with it? If it's a mock accessor it
doesn't get access to the AttachShadow method, so is there another way to
set that up?
Thanks again!
--Adam
On Tuesday, June 26, 2012 12:25:08 PM UTC-4, Adam wrote:
>
> Hey all,
>
> I'm trying to AssertWasCalled a certain method of a mocked (not stubbed)
> class, but the properties in it get reset to null.
>
> I have:
> Foo foo = MockRepository.GenerateMock<Foo>();
>
> Foo_Accessor fooAccessor = Foo_Accessor.AttachShadow(foo) // It's a
> private property, so I set it with an Accessor
>
> fooAccessor.Property = MockRepository.GenerateMock<PropertyClass>();
>
> // Do stuff that makes a call in foo.Method()
>
> // This stuff successfully runs foo.Method() with the foo.Property set as
> the proxy
>
> foo.AssertWasCalled(x => x.Method(""), o => o.IgnoreArguments());
>
>
> However, when it runs x.Method(""), it shows foo.Property as being null.
> Can I force-inject this property in the call? Or is there a way to
> permanently set it beforehand?
> I think the fact that I have to use an Accessor.AttachShadow makes it more
> complicated...
>
> Thanks for the help!
> --Adam
>
>
>
>
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Rhino.Mocks" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/rhinomocks/-/unkpLdYt-uQJ.
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.