I'm very new to TDD and I'm having trouble with one of my unit tests. I just can't seem to understand what to do next. :( I'm trying to unit test a service of mine called AccountService and I'm testing a method called DoLogin(username, password). Here's some example code:
[Test]
public void User_With_Correct_Username_And_Pass_Should_Login_Successfully()
{
// Arrange
var accountService = new AccountService();
// Act
bool result = accountService.DoLogin("test", "test");
// Assert
Assert.IsTrue(result);
}
public class AccountService : IAccountService
{
public bool DoLogin(string username, string password)
{
if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
return false;
return true;
}
}
So this test pasts but now what do I do?! How do I really test if a valid login occured? Do I need to implement an integration test and test the login against a real or in-memory DB? Sorry if I'm doing things totally incorrect. I really hope one day to get this TDD stuff down. Thanks