How do you unit test an interface?

后端 未结 5 1707
忘掉有多难
忘掉有多难 2020-12-13 13:37

For example, there is a interface IMyInterface, and three classes support this interface:

class A : IMyInterface
{
}

class B : IMyInterface
{
}         


        
5条回答
  •  生来不讨喜
    2020-12-13 14:11

    You do not test the interface directly, but you may write an abstract class that tests the contract a particular implementation should extend. A test of a concrete class would then extend the abstract class

提交回复
热议问题