/unit-test-workshop

Code for a unit test workshop

Primary LanguageC#MIT LicenseMIT

Unit Test Workshop

Introduction

This is a quick and dirty introduction into unit testing. The aim is to show the evolution of code from not unit testable to unit testable. I'll also introduce mocking with Moq and a nicer way to do your asserts with Fluent Assertions.

This is by no means an exhaustive or comprehensive workshop. The aim is to give a gentle introduction and provide a platform for experimentation and learning.

This repo has a number of branches which will be worked through in turn.

Step One

This branch introduces the library that we want to test. The code isn't unit testable at this stage

Step Two

In this branch we transform the code into a state which can be unit tested

Step Three

There are three step three branches (step-three, step-three-b and step-three-c). This step covers initial setup, writing a failing test and then writing the code needed to make the test pass

Step Four

In the step four branches (step-four and step-four-b) Moq and Fluent Assertions are introduced.

Step Five

There is no step five branch - clone the repo and use it as a playground!