I have a unit test which logs onto a database and checks the username and password, but I need to recreate these test now using mocks.
I have been searching online but cannot find anything like what I am trying to achieve. Below is the original test
[TestMethod()]
public void LoginTest()
{
this.errorText = string.Empty;
this.user = MasterDataManager.GetInstance().Login("JohnSmith", "123", out errorText);
Assert.AreEqual(string.Empty, errorText);
}
I have written a test from what I have found online, it passes but I don't really know why to be honest. I have used Rhino Mocks here but am open to any help or solutions to get me going
[TestMethod()]
public void LoginTestMock()
{
var repo = MockRepository.GenerateMock<IAbstractConnector>();
repo.Login("JohnSmith", "123", out errorText);
repo.VerifyAllExpectations();
}