Sorry, your browser is not supported
To have the best experience using Skillshare, we recommend that you use one of these supported browsers.

Learn Unit Testing with NUnit and C#

Elias Fofanov, Chance favors the prepared mind.

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
51 Videos (3h 40m)
    • 00 Promo

      5:45
    • 01 GettingStarted 01 Outline

      0:58
    • 01 GettingStarted 02 WhatIsUnitTest

      3:11
    • 01 GettingStarted 03 UnitTestingFrameworks

      3:25
    • 01 GettingStarted 04 FirstUnitTest

      8:43
    • 01 GettingStarted 05 NamingConventions

      4:34
    • 01 GettingStarted 06 RunDebug

      5:02
    • 01 GettingStarted 07 Benefits

      3:35
    • 01 GettingStarted 08 WhoShouldWrite

      2:51
    • 01 GettingStarted 09 Oath

      3:29
    • 01 GettingStarted 10 Conclusion

      1:15
    • 02 NUnit 01 Outline

      1:06
    • 02 NUnit 02 AssertIntro

      5:29
    • 02 NUnit 03 AssertDemo

      10:27
    • 02 NUnit 04 AAA

      1:01
    • 02 NUnit 05 RunFromConsole

      1:51
    • 02 NUnit 06 SetUp TearDown

      4:50
    • 02 NUnit 07 SetUp TearDown OneTime

      2:13
    • 02 NUnit 08 Parameterized

      3:11
    • 02 NUnit 09 Grouping

      2:14
    • 02 NUnit 10 CodeCoverage

      1:42
    • 02 NUnit 11 Conclusion

      1:38
    • 03 Mocking 01 Outline

      1:09
    • 03 Mocking 02 ProblemDemo

      3:43
    • 03 Mocking 03 RefactoringToTestableDesign

      4:19
    • 03 Mocking 04 TestDoubles

      5:55
    • 03 Mocking 05 TestDoubles Demo

      11:53
    • 03 Mocking 07 ProblemsWithHandRolled

      1:16
    • 03 Mocking 08 MockingFrameworks

      7:46
    • 03 Mocking 09 WritingTestsWithMockFramework

      7:45
    • 03 Mocking 10 NSubstituteKeyFeatures

      18:06
    • 03 Mocking 11 ClassicVsLondon

      2:23
    • 03 Mocking 12 Conclusion

      1:18
    • 04 TDD 01 Outline

      0:41
    • 04 TDD 02 WhatIsTDD

      5:00
    • 04 TDD 03 RedGreenRefactor

      4:16
    • 04 TDD 04 TDD and UpfrontDesign

      2:35
    • 04 TDD 06 Conclusion

      0:34
    • 05 BestPractices 01 Outline

      0:55
    • 05 BestPractices 02 Guarantees

      2:25
    • 05 BestPractices 03 Pragmatic

      5:16
    • 05 BestPractices 04 IntegrationTests

      4:18
    • 05 BestPractices 06 Singletons and Static

      7:02
    • 05 BestPractices 07 TooManyInterfaces

      5:56
    • 05 BestPractices 08 RefactoringDemo

      14:29
    • 05 BestPractices 09 TestCoverage

      2:37
    • 05 BestPractices 10 TestingTrivialCode

      2:59
    • 05 BestPractices 11 TestSingleConcern

      3:06
    • 05 BestPractices 12 MoreBestPractices

      10:19
    • 05 BestPractices 13 GeneratingUnitTests

      1:25
    • 05 BestPractices 14 Conclusion

      2:31

About This Class

Learn deeply the concepts and tools that you will need to build maintainable and reliable software.

Teaching Approach

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
  • Fake
  • Dummy
  • Stub
  • Mock

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.

How long is this course: The course is around 4 hours. All are video lectures. You will be able to download all the slides and code samples used in the course.

------------------------------------------------------------

Keywords related to the course:

  • Visual Studio unit testing tutorial
  • NUnit unit testing tutorial
  • Dot Net testing framework
  • C# unit test framework
  • Visual Studio unit testing framework tutorial
  • csharp unit testing tutorial TDD in C#
  • NSubstitute
  • TDD
  • Test Driven Development
  • unit testing C#

4

Students

--

Projects

Elias Fofanov

Chance favors the prepared mind.

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 nearly 7 years, primarily based on .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 ...

See full profile