User559104930 posted
First, do not under any circumstances include unit test code in your UI or code-behind. That is not what unit tests are for. Unit tests are for testing specific behavior of a class. For example, this tests the result of adding two numbers together:
[TestMethod]
public void Add_1And2_Returns3()
{
//arrange
Calculator calculator = new Calculator();
//act
int result = calculator.Add(1, 2);
//assert
Assert.AreEqual(3, result);
}
Unit testing is a very large subject about which entire books have been written. I would suggest picking up a copy of
The Art of Unit Testing.