What exactly is a unit test and how do I write one? I hear many times people write them before their app is even written, how can this be? I am under the impression that a unit test is some code that makes a call to a method of your app with a set value and expects a specific value to come back, if the specific value does not come back the test has failed. Am I wrong or mislead here? I read so much about unit testing this and that but I know very little about what it actually looks like in code so a sample would be great.
Is this a unit test?
start psuedo code...
CheckForDuplicateSubdomains(){
get all users in DB with matching subdomains
if greater than zero, fail test
}
PS: I am using ASP.NET MVC in C#