Someone today during my talk on TDD for Blazor on a JetBrains Webinar asked me for what live templates I was using.
What are Live Templates?
Live templates are ways of quickly adding code. Usually you have 1-5 characters you type and then you hit “tab” and it will generate you lots more code. Sometimes these are called “snippets.”
If you want to see me using one from the webinar today check this out at around the 44:08 mark.
What Live Templates do I have?
I have four Live Templates related to testing:
xfwhich generates an xUnit Fact without async
xfawhich generates an async xUnit Fact
xtwhich generates an xUnit Theory without async
xtawhich generates async xUnit Theory
To add these to JetBrains Rider, you can open up your settings, go under Live Templates, then C#, and then you can add a new live template. Here are the settings.
xf for adding an xUnit Fact without async
Note: the words between $$ means your cursor will end up there and you can tab your way through those.
xfa for adding an async xUnit Fact
xt for adding an xUnit Theory without async
xta for adding an async xUnit Theory