I am new to Moq and need to know if I am doing this right.
In AccountController.cs I have this:
int id = _userRepository.GetProfileFromUserName(userName).ProfileID;
UserRepository is mocked, but ProfileID comes from DataContext, so I did this in my AccountControllerTests.cs:
mockUserReposository.Setup(gp => gp.GetProfileFromUserName(userName)).Returns(new Profile { ProfileID = 1 });
This way I get the id variable to be equal to 1, and ensure that ProfileID doesn t use the one from DataContext when called in AccountController.cs
Is this the right way to do it? Or do I somehow need to mock my whole Profile table from Linq to SQL?