Using Moq To Test An Abstract Class

前端 未结 2 1080
臣服心动
臣服心动 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:44

    The message is because your Test method is not public. Test methods need to be public. Even after making the test method public it will fail as you can only verify abstract/virtual methods. So in your case you will have to make the method virtual since you have implementation.

提交回复
热议问题