How to use Unity.RegisterType with Moq?

后端 未结 1 1570
暗喜
暗喜 2021-02-13 12:04

I have a running code with unity.

Now I want to use Moq to do my unit testing for ASP-MVC. In the global.asax\'s code, I have the following:

IUnityCon         


        
1条回答
  •  太阳男子
    2021-02-13 12:09

    You are trying to register the mock-object, not the mocked-object.

    var mock = new Mock();
    container.RegisterInstance(mock.Object);
    

    0 讨论(0)
提交回复
热议问题