Have a odd problem where values are being lost from my mock/stub
objects.  I can see the property value is initially set, however after
it is passed to a constructor the property is reset to null.  An
approximation of the code I am using is shown below.  When I set a
break point on the line marked with '** 1 **', I can see the property
is set. I can reproduce the situation if I use the 'Make Object ID' in
the watch window. Before making the object id, the property has a
value. After selecting 'Make Object ID', the property is reset to
null.  If I do not use the 'Make Object ID' and step into the
constructor, the Context property of the IUserController is set to
null as well.  HttpContextBase is from System.Web.Abstractions.dll
v3.5.0.0. Both GenerateStub and GenerateMock appear to be behaving the
same.

Am I doing something wrong?

public interface IUserController { HttpContextBase Context { get; } }

[Test]
public void Test() {
    // Arrange
    IUserController userController  =
MockRepository.GenerateStub<IUserController>();
    HttpContextBase httpContextBase =
MockRepository.GenerateStub<HttpContextBase>();

    userController.Expect(uc => uc.Context).Return(httpContextBase);

    EncounterDetailsPresenter presenter = new
EncounterDetailsPresenter(userController); // ** 1 **

    // Act
    presenter.OnViewLoaded();

    // Assert
}

VS.NET Version: Visual Studio 2008 Pro SP1
Target Framework: 3.5
Rhino-Mocks Version: Rhino-Mocks-net-3.5-v3.5 (3.5.0.1337)
ReSharper: 4.1.937.1
NUnit: 2.4.6.0

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to