Today I contributed to NuGet!
Some time ago I created NUnit snippets for myself. Then I thought that it may be worth publishing them so other NUnit users can save some time when writing asserts. And today as a big fan of NUnit I published NUnit.Snippets Nuget package! – NUnit.Snippets on NuGet.org.
To install it just run Install-Package Nunit.Snippets from Package Manager Console and you should see this.
You can notice on the screenshot that package copies snippets and uninstalls itself right after installation. This is to not leave track in packages folder. After you install it snippets are available for every projects you will ever create. Also on this screenshot you can notice that together with snippets there is summary file copied containing information on all the snippets that this package installs.
All snippet shortcuts follow the same convention. They all start with ‘at’ and then the first letters of words from constraints follow.
For example for
you would have to type
atinn tab tab
Assert.That(actual, Is.EqualTo(expected).Within(tolerance).Milliseconds) you can type
atiewms. I think you get the idea.
If you can’t get the right shortcut you can always select snippet from dropdown list opened with Ctrl+K, X (default VS keyboard shortcut).
To remove snippets just delete the folder with snippets.
If you have any suggestions on how to make this snippets better I’m opened for suggestions.
Hope you find it useful.