Learn Unit Testing with NUnit and C# (The Course)
This Course is part of the following Tracks:
No fluff, no ranting, no beating the air. I esteem your time. The course material is succinct, yet comprehensive. All important concepts are covered. Particularly important topics are covered in-depth. For absolute beginners, I offer my help on Skype absolutely free, if requested.
Take this course, and you will be satisfied.
Build a solid foundation in Unit Testing with this course
This course is all about writing effective unit tests using C# programming language and NUnit as a unit testing framework. Along the way, we will learn the concepts related to unit testing. Today unit testing is an absolutely required skill from any professional developer. Companies expect from developers to know how to write unit tests including all the most important topics such as mocking and test driven development (TDD in short). This course does not cover all the features of NUnit. This course is way more interesting.
Learning unit testing puts a powerful and very useful tool at your fingertips. Being familiar with unit testing you can write reliable and maintainable applications. It is very hard to lead a project which is not covered by unit tests.
Content and Overview
This course is primarily aimed at beginner developers. It provides solid theoretical base reinforced by tons of practical material.
We start with basics of unit testing. What is a unit test? What unit testing frameworks exist? How to run and debug unit tests. After getting acquainted with the basics, we will get to the NUnit framework. Here you’ll learn how to install the framework, set the runner. Then you’ll learn the basics of assertions and arrange-act-assert triplet. Other key features of NUnit are also covered:
- Running tests from the console
- Setup and teardown unit tests
- Parameterized tests
- Grouping and ignoring
Practicing writing of unit tests, it’s impossible to avoid applying mocks. I like the word “test double” more, in general. By the way, you’ll learn what the difference between the following notion is:
- Test double
You’ll learn how to write test doubles manually. You will also see a simple example of how to use a mocking framework for using mocks. I’ll use NSubstitute mocking framework for demonstration.
At the end of this section, you’ll get acquainted with two key approaches to unit testing, Classic or Detroit School and London School of unit testing.
You’ll separately learn the basic of test-driven development. It is hard to imagine a modern professional developer who doesn’t know about TDD, so you’ll learn what it is and what it is about. You’ll see the Red-Green-Refactor triplet in action.
I could not complete the course avoiding the best practices of writing unit tests. You’ll learn the basic concepts of the modern approach to unit testing called “pragmatic unit testing”. You’ll see what problems static classes and singletons bring regarding the unit testing. They make code harder to unit test. After that, you’ll learn the problem of extracting interfaces just for the sake of introducing shims for injecting dependencies.
You’ll know should you write unit tests for the trivial code. You’ll learn a lot more in the course.
So, in short, the course covers the following topics:
- Basic notions of Unit Testing
- NUnit and its basic features
- Test Doubles including fakes, dummies, stubs, spies and mocks
- How to write manual test doubles and how to use a mocking framework
- TDD, red-green-refactor triplet
- A great number of best practices of writing unit tests
In the end, we will recap what you have learned, and you will try to understand where you have to go further with the intention to master your skills.
- Getting Started
- What is a Unit Test
- Unit Testing Frameworks
- Your First Unit Test
- Naming Conventions
- Running and Debugging Unit Tests
- Benefits of Unit Testing
- Who Should Write Unit Tests and When
- Programmer’s Oath
- NUnit Framework
- Assert Intro
- Assert Demo
- Running Tests from the Console
- SetUp and TearDown
- OneTimeSetUp and OneTimeTearDown
- Parameterized Unit Tests
- Grouping and Ignoring Unit Tests
- Code Coverage
- Test Doubles
- Demo of a Testing Problem
- Refactoring to Make Code Testable
- Test Doubles
- Hand-Rolled or Manual Test Doubles
- Problems with Manual Test Doubles
- Mocking Frameworks
- Writing Unit Tests with a Mocking Framework
- NSubstitute Mocking Framework. Key Features. Demo
- Detroit School vs London School of Unit Testing
- Test-Driven Development
- What is TDD
- Red Green Refactor
- TDD and Design Upfront
- TDD Demo
- Do Unit Tests Guarantee the Success
- Pragmatic Unit Testing
- Integration Tests
- Singletons and Static Classes
- Header Interfaces
- Demo of Refactoring to a Testable Design
- How Much Test Coverage is Enough
- Testing Trivial Code
- The Rule of Testing a Single Concern
- More on Best Practices
- Generating Unit Test Method Signatures
I'm thankful enough for that I love what I do.
I began my career as a postgraduate student participating in Microsoft ImagineCup contest.
I've been working with .NET platform since 2003. I've been professionally architecting and implementing software for more than 10 years, primarily based on the .NET platform. I'm passionate about building rich and powerful applications using modern technologies. I'm a certified specialist in Windows Applications and Service Communication Applications by Microsoft. I'm one of the coordinators of the MskDotNet User Group in Moscow.
"If it's work, we try to do less. If it's art, we try to do more." - Seth Godin.
What I can say is that software is my art.
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
80% Royalties. Earn $16 on a $20 book.
We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $12 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.