Here\'s my class implementation where the generic is implementing two interfaces...
public class ClassA : where TGeneric: IInterfaceA, IInter
As alternative to the accepted answer you can achieve what you need by casting the mocked object to dynamic
and at runtime it will work as expected.
void Main()
{
var mockA = new Mock();
mockA.Setup(a => a.DoA()).Returns(3);
var mockB = mockA.As();
mockB.Setup(iib => iib.DoB()).Returns(7);
dynamic d = mockB.Object;
TakeBoth(d);
}
void TakeBoth(T obj) where T : IIntA, IIntB
{
}
public interface IIntA { int DoA(); }
public interface IIntB { int DoB(); }