How to stub out a generic method definition in an interface using Microsoft Fakes in c#
问题 I have a unit test which stubs out the following interface using Microsoft Fakes: public interface ITable { Task<TableResult> Retrieve(string tableReference, string partitionKey, string rowKey); } The stub looks like this: ITable table = new MessagesAPI.Azure.Fakes.StubITable() { RetrieveStringStringString = delegate { TableResult tableResult = new TableResult(); return Task.FromResult(tableResult); } }; This works fine. However I'd like to change the interface to be more generic like so: