开发者

ASP.Net MVC Moq SetupGet

I am starting out with TDD using Moq to Mock开发者_如何学JAVA an interface that I have:

public interface IDataService
{
    void Commit();
    TopListService TopLists { get; }
}

From the samples I have seen I would expect SetupGet (or Setup) to appear in the intellisense when I type

        var mockDataService = new Mock<IDataService>();

        mockDataService.

But it is missing. Could someone suggest why?


Make sure you are using the latest version of Moq.


It sounds like a problem with your project setup, rather than with Moq.

  • Check that your source code compiles successfully (or Mock<IDataService> will be meaningless).
  • Check that your test project is referencing Moq.
  • Check that the Mock you're using is Moq.Mock and not from another namespace.
  • Otherwise I'd put money on it being Visual Studio. Close it down, open it up again, see if Intellisense wakes up.

If you can type the code that ought to work and make it build, then it's definitely Visual Studio playing up.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜