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 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:
How to assert that an action was called
but my Action 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?
The UpdateData should be virtual otherwise rhino mock can not overwrite method
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With