I decided to learn how to write code snippets and wrote a couple quick ones to help out my NUnit testing. You can grab them here.
What’s in these snippets?
Just a couple quick & easy Assert completers. Hopefully these will help you learn how to write your own (better) snippets.
- ae – Assert.AreEqual(expected, actual);
- ait – Assert.IsTrue(true);
- aif – Assert.IsFalse(false);
How to install snippets
Copy and paste the XML from the link above and save it in a file with the extension .snippet. I’d recommend saving it in the default code snippets folder (C:\Users\lskywalker\Documents\Visual Studio 2008\Code Snippets\Visual C#\My Code Snippets). Then, in Visual Studio, go to Tools -> Code Snippets Manager…, and click Add. Navigate to the file you saved, and you’re done!
Neat! Where can I learn more?
Everything I learned, I learned from the MSDN articles about code snippets.
Good luck, and happy coding.