Mocking Generic Method with NSubstitute
I have an interface with a number of generic methods. These methods perform operations based on the type of data that is passed in. How do I mock this with NSubstitute? At the moment, I had to resort to using a concrete class instead of a mock since I cannot handle all possible types that the method will be called with. public interface IInstanceSource { bool CanCreate<T>(); T Create<T>(); void Register<T>(Func<T> creator); } public static IInstanceSource GetInstanceSource() { var _data = new Dictionary<Type, Func<object>>(); var a = Substitute.For<IInstanceSource>(); //code below fails since