Mocking generics that implement multiple interfaces

前端 未结 2 1460
北恋
北恋 2021-01-18 19:05

Here\'s my class implementation where the generic is implementing two interfaces...

public class ClassA : where TGeneric: IInterfaceA, IInter         


        
2条回答
  •  自闭症患者
    2021-01-18 19:23

    You could define an interface that includes both interface A and B (in your test project, for testing purposes), then use that in your mock.

    public interface ICanTestAAndB : IInterfaceA, IInterfaceB {}
    
    var mock = new Mock>();
    

提交回复
热议问题