public interface IOffsetRoller
{
  string Symbol { get; }
}

[Test]
public void ShouldAllowStubbingOfGetterWithNoSetter()
{
  var roller = MockRepository.GenerateStub<IOffsetRoller>();
  roller.Stub(x => x.Symbol).Return("fake symbol");
}

The last line throws the following:

System.InvalidOperationException: You are trying to set an expectation
on a property that was defined to use PropertyBehavior.
Instead of writing code such as this: mockObject.Stub(x =>
x.SomeProperty).Return(42);
You can use the property directly to achieve the same result:
mockObject.SomeProperty = 42;

The suggestion does not work because the property has no setter.

Any ideas?

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