Yes that is correct, if that is possible of course.  For now I'm just doing 
Arg<T>.Is.Anything to get the tests to pass.




>________________________________
> From: Patrick Steele <[email protected]>
>To: [email protected] 
>Sent: Tuesday, February 28, 2012 7:18 AM
>Subject: Re: [RhinoMocks] Testing if a lambda/action was called by a Mock
> 
>I can't wrap my head around a purely Rhino Mocks way of testing this.
>The complexity is that your IDataCenterMsmqWriter.UpdateData method
>will accept *any* void method that takes a DataCenterWcfProxy.  I
>assume you want to test that *only* the SendVarData method is called?
>
>---
>Patrick Steele
>http://weblogs.asp.net/psteele
>
>
>
>On Mon, Feb 27, 2012 at 12:35 PM, Mark W <[email protected]> wrote:
>> Here's what I have:
>>
>>       public interface IDataCenterMsmqWriter
>>       {
>>          void UpdateData(Action<DataCenterWcfProxy> action);
>>       }
>>
>> System under test:
>>
>>    public class WcfService : IWcfService
>>    {
>>        private readonly IDataCenterMsmqWriter _writer;
>>
>>        public WcfService(IDataCenterMsmqWriter writer)
>>        {
>>            _writer = writer;
>>        }
>>
>>        #region IWcfService members
>>
>>        public void SendData(SomeData data)
>>        {
>>            _writer.UpdateData(d => d.SendVarData(data));
>>        }
>>
>>        // other members of IWcfService elided
>>        #endregion
>>    }
>>
>> How do I test with Rhino Mocks setting the _writer as a Mock and want
>> to test that the correct Action<DataCenterWcfProxy> was called in the
>> UpdateData method.
>>
>> I've tried this:
>>
>>    // _writer is setup as a mock
>>    var data = new SomeData();
>>    _wcfServiceSUT.SendData(data);
>>    _writer.AssertWasCalled(d => d.UpdateData(x =>
>> x.SendVarData(data));
>>
>> doesn't work.
>>
>> I can add the:
>>
>> , p => p.IgnoreArguments() after the UpdateData inside the
>> AssertWasCalled, but that does not give me what I want, to make sure
>> SendVarData was called with the data variable.
>>
>> I've looked at this:
>>
>> http://stackoverflow.com/questions/6413040/rhino-mocks-how-to-assert-that-an-action-was-called
>>
>> but my Action<DataCenterWcfProxy> isn't mocked like mockDialogService
>> in his example.
>>
>> Is there a way to test if an Action or Func was called properly with
>> the right input parameters, etc?
>>
>> --
>> 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.
>>
>
>-- 
>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.
>
>
>
>

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