Testing styles go a long way to making tests readable. Tests help document how the code is used within the system, as well as document certain requirements and acceptance criteria. Test styles help give tests a consistent form and flow so that reading them "flows" and that they are more consistent with one another. Let's go over a couple of well-known testing styles.
Probably the most common test style is Arrange, Act, Assert. This is sometimes referred to as the AAA style. This style of writing separates the code that arranges the variables and state of the test, from the act of operating on the state, from the asserting that the expected state exists at the end of the test.
An example of a test that uses the Arrange, Act, Assert style:
namespace UnitTests { [TestClass] public class Class1Tests { [TestMethod] public void TestMethod1() { // Arrange var o = new Class1(); // Act var actual = o.Method1(); // Assert Assert.AreEqual(42, actual); } } }
But, don...