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.
