Most examples I see of Unit tests are simple tests like Assert.That(5, 2 + 3), but how would I incorporate a unit test a method that gets a users information and saves them to a database. For example, I have a Register method that takes a User object. The User object properties are populated from a web form and then it is saved to the database. What are some viable unit tests that I could do with this?
Here is an example. Assume that the User object has some required fields such as Email, FirstName, LastName. Would a valid unit test assert that Email is not null or empty. The same applies to other required fields. So in my scenario above, would this be a unit test.
[Test]
public void EmptyEmailShouldReturnError()
{
User user = new User();
user.Email = "";
//Set other properties
//Not sure of nunit syntax here, so I will make something up.
Assert.IsNotEmpty(user.Email);
}