Code Snippet: Unit Test Methods

While researching Unit Testing, I reviewed several different C# Code Snippet examples for generating Unit Test Methods (Functions) within Visual Studio and this is my take on it…

How to Use

  1. Save the Code Snippet file as UnitTestMethod.Snippet
  2. For for VS 2015, move the UnitTestMethod.Snippet file into this directory: %userprofile%\Documents\Visual Studio 2015\Code Snippets\Visual C#\My Code Snippets
  3. Once installed type: utest + [Tab] + [Tab]
[TestMethod]
public void MethodName_Condition_ExpectedResult()
{
 // Arrange


 // Act


 // Assert
 Assert.Fail();
 
}

Note: typing testc + [Tab] + [Tab] will generate a new empty Unit Test Class

Code Snippet: Async Unit Test Methods

Categories

Recent Posts

Buy Siôn a beer…

If you have found my website useful and would like to buy me a beer, please click on this Donate PayPal button.

%d bloggers like this: