Unit testing can make you a faster developer. Good tests let us move forward more confidently, give us instant feedback when checking regression, and help us pinpoint bugs when things go wrong. In this workshop, we’ll look at the qualities of good tests, including isolation, repeatability, runnability, and more. And we’ll look at specific techniques that make our tests easy to ready, easy to write, and easy to run.
We’ll go hands-on with TDD (Test-Driven Development) to see the red-green-refactor cycle in action. Some code is tricky to test: we’ll look at how to test for exceptions and error states, and we’ll use a mocking framework to create mocks and stubs. Tools include MSTest and NUnit (for testing) and Moq (for mocking), but the skills easily translate to other frameworks.
Objectives +Characteristics of a good unit test and how to implement them (including isolation, repeatability, runnability, and more) + Basics of TDD + Parameterizing tests + Techniques for testing exceptions + Using a mocking framework to isolate dependencies
Pre-Requisites Basic understanding of C# and object-oriented programming (classes, inheritance, methods, and properties). In addition, experience with interfaces and other forms of abstraction is very helpful. No prior experience with unit testing is necessary; we’ll take care of that as we go.