Mock any implementation of a generic interface with one declaration.

services.AddTransient(typeof(IGenericInterface<>), typeof(GenericClass<>));