I'm not 100% certain of this, but I think this behaviour is apparent
because you have used a Stub and you have only stubbed the IFeature
interface.

What does puzzle me however is thatyou are not getting an exception
from this line:

((INamedObject)feature).DisplayName = "some name";

since this member only has a getter and not a setter, I would expect
that you would need to set the return value as follows

((INamedObject)feature).Stub(no => no.DisplayName).Return("some
name");

... without having tried the above code, I'm not even sure if that
would/should work.

On Feb 10, 2:48 pm, Samuel <[email protected]> wrote:
> I recently upgraded to RhinoMocks 3.6 and Castle.Windsor 2.1. I
> started having an issue with a shadowed property, something like this:
>
> public interface INamedObject
> {
>    public string DisplayName {get;}
>
> }
>
> public interface IFeature : INamedObject
> {
>    new public string DisplayName {get;set;}
>
> }
>
>  [TestMethod]
>  public void TestMethodThatFails()
>  {
>      var feature = MockRepository.GenerateStub<IFeature>();
>      feature.DisplayName = "some name";
>
>      Assert.AreEqual("some name", feature.DisplayName);
>      Assert.AreEqual("some name",
> ((INamedObject)feature).DisplayName);
>  }
>
>  [TestMethod]
>  public void TestMethodThatPasses()
>  {
>      var feature = MockRepository.GenerateStub<IFeature>();
>      feature.DisplayName = "some name";
>      ((INamedObject)feature).DisplayName = "some name";
>
>      Assert.AreEqual("some name", feature.DisplayName);
>      Assert.AreEqual("some name",
> ((INamedObject)feature).DisplayName);
>  }
>
> Although there is this workaround, is this a breaking change or a bug?
>
> I have detailed it on my 
> blog:http://smoura.com/index.php/tdd/2010/02/06/rhinomocks-stub-not-retain...

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