The code below works for me are you sure the code below is what you were
testing...here is EXACTLY the code I use to run the example that passed.

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

            Assert.That(roller.Symbol, Is.EqualTo("fake symbol"));
            Console.WriteLine(roller.Symbol);
        }
    }

    public interface IOffsetRoller
    {
        string Symbol { get; }
    }

On Sun, Dec 7, 2008 at 8:46 PM, gnash <[EMAIL PROTECTED]> wrote:

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