Using Moq To Test An Abstract Class

前端 未结 2 1100
臣服心动
臣服心动 2020-12-31 07:01

I am trying to run a unit test on a method in an abstract class. I have condensed the code below:

Abstract Class:

public abstract class TestAb
{
            


        
2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-31 07:50

    If you want to mock methods on an abstract class like this, then you need to make it either virtual, or abstract.

提交回复
热议问题