Moq - How to mock web service call?
问题 The using below hits an external resource that I do not want to actually hit. I want to test someResult and the code that uses it, but every time I run my unit test, this code still tries to hit the real web service. How do I use moq to fake the real call to the web service, but not mock the rest of the code within the using? public IMyInterface.SomeMethod() { // hits a web service using ( mySoapClient client = new mySoapClient() ) { var someResult = client.DoSomething(); ... ... } }