2008/11/18 Iain Waddell <[EMAIL PROTECTED]>

> A bit ugly, but you can do it like this:
>>
>>             demo.AssertWasNotCalled(x => var dummy = x.FooBar);
>>
>> That doesn't compile here. I get three syntax errors.
>

Figured it out:

demo.AssertWasNotCalled(x => { var dummy = x.FooBar; });

Thanks for the pointer.

Iain

>
>> On Tue, Nov 18, 2008 at 2:45 PM, Iain Waddell <[EMAIL PROTECTED]>wrote:
>>
>>> I'm trying to assert that a read only property was not called.
>>>
>>> Looking at the demo code I found, I thought it should be possible
>>>
>>>         [Test]
>>>         public void CanAssertNotCalledOnPropertyAccess()
>>>
>>>         {
>>>             MockRepository mocks = new MockRepository();
>>>             IFoo54 demo = mocks.DynamicMock<IFoo54>();
>>>             mocks.Replay(demo);
>>>
>>>             demo.DoSomething();
>>>
>>>             demo.AssertWasNotCalled(x => x.FooBar);
>>>
>>>
>>>
>>>         }
>>>
>>> However when the property is read only (not read / write as in the
>>> example above) I get the following error:
>>>
>>> Only assignment, call, increment, decrement, and new object expressions
>>> can be used as a statement
>>>
>>> I'm sure there's a simple work around but I can't see it.
>>>
>>> Iain
>>>
>>>
>>>
>>
>> >>
>>
>

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