Nicholas Murray
Nicholas Murray

Reputation: 13533

ASP.Net MVC Moq SetupGet

I am starting out with TDD using Moq to Mock 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?

Upvotes: 0

Views: 427

Answers (2)

Lunivore
Lunivore

Reputation: 17602

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.

Upvotes: 1

Darin Dimitrov
Darin Dimitrov

Reputation: 1038720

Make sure you are using the latest version of Moq.

Upvotes: 2

Related Questions