I'm deeply sorry for being late with the response to your ticket. It is very rare for us to be this sloppy and let tickets linger for this long.
The solution I gave you didn't take more than 5 minutes to write and test. It looks like it was written from the inside out, but it's not. I started writing it from the outermost part, OperationContext.Current, and as I delved deeper, I piled the newly mocked inner members at the top of the test method. Essentially, I wrote the code backwards, with new code getting inserted at the top.
As an alternative to this style of writing, there is the expressive "mocking by example
" approach, which produces code in a more top-down fashion:
var operationContext = Mock.CreateLike<OperationContext>(oc =>
== Mock.CreateLike<RemoteEndpointMessageProperty>(endpoint => endpoint.Address ==
Mock.Arrange(() => OperationContext.Current).Returns(operationContext);
var ip = GetCallerIPAddress();
You can mix and match the two styles to your liking. If you have any other questions regarding mocking, don't hesitate to ask us once again.
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.