TDD and the Art of Unit Testing in C# with Roy Osherove

Unit testing, done badly, can hurt your project more than it helps. In some cases, it may lead to project schedule delays, and unhappy developers due to huge maintenance problems. But when unit testing is done right, it can help the project and developers’ confidence immensely.

The challenge is - how do you do it in a way that is helping, rather than hurting your project? 

In this workshop we will learn essential test driven skills and techniques for writing unit tests in a readable, maintainable and trustworthy fashion, so that we can feel more confident in our code, make it simpler, and save ourselves time in debugging and maintaining our code base. We will also look at some code design issues that hurt testability. 

  1. Learn how to write readable, maintainable, trustworthy unit tests using C#, XUnitNUnit and other unit testing tools and frameworks.  

  1. Learn how to refactor and test legacy code, and what to do when we cannot change existing code. 

  1. Learn the principles of Test Driven Development, and develop new features using TDD. 

  1. Learn how to Pair Program, and experience it throughout the course.

  1. Learn about mocks, stubs fakes, and the difference between them. 

  1. Learn about Isolation (mocking) frameworks, how they work, and why some frameworks are more capable than others. 

Detailed content

Day 1: Beginnings 

  • What is the “unit” in “unit testing”? A discussion about unit of work. 
  • The first unit test 
  • Basic NUnit APIs, test runners, tips and tricks 
  • Writing readable tests 
  • Test Driven Development Introduction 
  • String Calculator Kata Exercises 
  • Value based, State Based and Interaction Based Tests 

Day 2 Mock Objects and Stubs 

  • Understanding Fakes, Mocks and Stubs 
  • Hand Written Fakes, Stubs and Mocks 
  • Interaction Test Exercises with Hand Written Fakes 

Day 3: Isolation Frameworks  

  • Isolation Frameworks: Constrained and Unconstrained  
  • Isolation Framework Comparisons (Rhino Mocks, TypemockMoqFakeItEasyNSubstituteNUnitMocksMsFakes) 
  • Exercises 
  • Unit Testing Best Practices
  • Code Review Exercises 

About Roy Osherove

Roy is the author of "The Art of Unit Testing", "Elastic Leadership" and the "Enterprise DevOps" books. He is an independent consultant working across Europe caching about TDD, Leadership, DevOps, and everything that is needed to make those three tick. 

Target Audience and Prerequisites

This course is aimed at experienced .NET developers and you need at least 2 years experience of C# Standard or .NET Core in real projectsNo unit testing experience is needed. 

This course is taught in English. 

Om kursen

Pris: 26 450,00 kr

exklusive moms

Längd 3 dagar
Kurskod MC062

Kursen hålls på begäran

Kontakta oss för mer information.

Telefon: 08-562 557 50