There is helpful post regarding the matter in Software Engineering the code will look something like this:
private void Test<TService,TFilter>(string urlSuffix)
where TService : SoapHttpClientProtocol, new()
where TFilter : new()
{
string serviceUrl = Helper.GetBaseUrl() + urlSuffix;
TService service = new TService();
service.Credentials = Helper.GetCredentials();
service.Url = serviceUrl;
TFilter[] filter = { new TFilter() };
service.ReadMultiple(filter, null, 0);
}
[TestMethod]
public void PlaceOfWork()
{
Test<PlaceOfWork_Service,PlaceOfWork_Filter>("PlaceOfWork");
}
This is a generic method to mock service connection and access but it can easily be applied to interfaces as well.
However Be ware that if you use generics in unit test you lose granularity, this is because your test is going to cover multiple cases.
It will soon become unclear what you are testing in each interface
If your test fails after the first one, you fail to uncover more bugs resulting in fail masking..
Check this solution, twitch with it a little bit in order to understand all of it's advantages and disadvantages and read similar posts as well.