Can't get a very good picture from your code. But probably you can do this
or similar:
[Test]
public void TestHandle_CreateCorrectClassY()
{
var a = MockRepository.GenerateStub<ClassA>();
var b = MockRepository.GenerateStub<ClassB>();
var z = MockRepository.GenerateStub<ClassZ>();
b.Stub(b => b.PropertyA).Return(z);
z.Stub(z => z.GetID()).Return("x");
var cut = new ClassUnderTest();
var result = cut.Handle(a, b);
Assert.AreEqual("x", result.X);
}
I have assumed that ClassB's PropertyA and ClassZ's GetID are mockable (in
another word, they are virtual), and ClassY has property X which you can
verify if it has correct value.
On Thu, Dec 3, 2009 at 9:11 AM, gsogol <[email protected]> wrote:
> In my tests, I don't really instantiate or create anything myself.
> I do:
>
> RhinoAutoMocker<ClassX> mocker1 = new RhinoAutoMocker<ClassX>();
> RhinoAutoMocker<ClassB> mocker2 = new RhinoAutoMocker<ClassB>();
> mocker1.ClassUnderTest.Handler(null, mocker2.ClassUnderTest)l
>
> But that's not working. If RhinoAutoMocker is outside of this forum,
> feel free to use standard RhinoMocks code.
>
> --
>
> 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.