Unit Testing for C Developers

Master unit testing C# code with NUnit and Moq: all about dependency injection, best practices and pitfalls to avoid
Unit Testing for C Developers
File Size :
2.78 GB
Total length :
5h 48m



Mosh Hamedani


Last update




Unit Testing for C Developers

What you’ll learn

Learn unit testing from scratch
Tips and tricks to write clean, maintainable and trustworthy tests
Write loosely-coupled and testable code
Refactor legacy code towards testable code
Understand and implement dependency injection
Use mocks to isolate code from external dependencies
Apply the unit testing best practices
Learn the anti-patterns to avoid

Unit Testing for C Developers


Minimum 3 months programming in C#


Picture this: you make a simple change to the code and suddenly realize that you created a dozen unexpected bugs. Sound familiar? You’re not alone!
Good news is, unit testing can make this a thing of the past.
Maybe you’ve heard of automated or unit testing before and you’re keen to learn more.
Or perhaps you’ve tried to learn it and got a bit lost or ended up with fat and fragile tests that got in the way and slowed you down.
Either way, what you need is a course that will teach you all you need to know about this essential skill – from the basics, right through to mastery level.

What is unit testing?
In a nutshell: it’s the practice of writing code to test your code and then run those tests in an automated fashion.

Why learn unit testing?
Why write extra code? Wouldn’t that take extra time to write? Would that slow you down? Why not just run the application and test it like an end user?
Thinking like this is the mistake lots of people make. I used to make it myself. I’ve had to learn the hard way!
I learned pretty fast that if you’re building a complex application or working on a legacy app, manually testing all the various functions is tedious and takes a significant amount of time.

As your application grows, the cost of manual testing grows exponentially. And you’re never 100% sure if you’ve fully tested all the edge cases. You’re never confident that your code really works until you release your software and get a call from your boss or an end user!
Several studies have shown that the later a bug is caught in the software development lifecycle, the more costly it is to the business.
Automated tests help you to catch bugs earlier in the software development lifecycle, right when you’re coding. These tests are repeatable. Write them once and run them over and over.

The benefits of using unit tests are:
help you to catch and fix bugs earlier, before releasing your app into productionhelp you to write better code with less bugshelp you to produce software with better design – extensible and loosely-coupledgive you rapid feedback and tell you if your code *really* worksforce you to think of edge cases that you didn’t realize existedtest your code much fastertell if you have broken any functionality as you write new codeallow you to refactor your code with confidenceact as documentation about what your code doessave you both time and money

A valuable skill for senior developers
More and more companies are recognizing the advantages of automated testing, that’s why it’s a must-have for senior coders. If you’re looking to reach the higher levels in your coding career, this course can help.
You don’t need any prior knowledge of automated testing. You only need 3 months of experience programming in C#.

With this course you’ll learn:
senior coder secrets – best practices to write great unit teststips and tricks to keep your tests clean, trustworthy and maintainablethe pitfalls to avoid – anti-patternshow to refactor legacy, untestable code into loosely-coupled and testable codeall about dependency injection – the one thing every coder needs to knowthe power of mocks – when and how to use them and when to avoid

You’ll get:
6 hours of HD videotutorials and guidance from a senior coder with 15+ years’ experienceexercises with step-by-step solutiondownloadable source codelifetime accessaccess online or offline at any time on any devicecertificate of completion to present to your current or prospective employer


Section 1: Getting Started

Lecture 1 What is Automated Testing

Lecture 2 Benefits of Automated Testing

Lecture 3 Types of Tests

Lecture 4 Test Pyramid

Lecture 5 The Tooling

Lecture 6 Source Code

Lecture 7 Writing Your First Unit Test

Lecture 8 Testing All the Execution Tests

Lecture 9 Refactoring with Confidence

Lecture 10 Using NUnit in Visual Studio

Lecture 11 What is Test-Driven Development

Lecture 12 Course Structure

Lecture 13 Summary

Lecture 14 Asking Questions

Section 2: Fundamentals of Unit Testing

Lecture 15 Introduction

Lecture 16 Characteristics of Good Unit Tests

Lecture 17 What to Test and What Not to Test

Lecture 18 Naming and Organizing Tests

Lecture 19 Introducing Rider

Lecture 20 Writing a Simple Unit Test

Lecture 21 Black-box Testing

Lecture 22 Set Up and Tear Down

Lecture 23 Parameterized Tests

Lecture 24 Ignoring Tests

Lecture 25 Writing Trustworthy Tests

Lecture 26 Developers Who Don’t Write Tests

Lecture 27 Summary

Section 3: Core Unit Testing Techniques

Lecture 28 Introduction

Lecture 29 Testing Strings

Lecture 30 Testing Arrays and Collections

Lecture 31 Testing the Return Type of Methods

Lecture 32 Testing Void Methods

Lecture 33 Testing Methods that Throw Exceptions

Lecture 34 Testing Methods that Raise an Event

Lecture 35 Testing Private Methods

Lecture 36 Code Coverage

Lecture 37 Testing in the Real-world

Lecture 38 Summary

Section 4: Exercises

Lecture 39 19- Exercise- FizzBuzz

Lecture 40 20- Solution- FizzBuzz

Lecture 41 Exercise- DemeritPointsCalculator

Lecture 42 Solution- DemeritPointsCalculator

Lecture 43 Exercise- Stack

Lecture 44 Solution- Stack

Section 5: Breaking External Dependencies

Lecture 45 Introduction

Lecture 46 Loosely-coupled and Testable Code

Lecture 47 Refactoring Towards a Loosely-coupled Design

Lecture 48 Dependency Injection via Method Parameters

Lecture 49 Dependency Injection via Properties

Lecture 50 Dependency Injection via Constructor

Lecture 51 Dependency Injection Frameworks

Lecture 52 Mocking Frameworks

Lecture 53 Creating Mock Objects Using Moq

Lecture 54 State-based vs. Interaction Testing

Lecture 55 Testing the Interaction Between Two Objects

Lecture 56 Fake as Little As Possible

Lecture 57 An Example of a Mock Abuse

Lecture 58 Who Should Write Tests

Section 6: Exercises

Lecture 59 Exercise- VideoService

Lecture 60 Refactoring

Lecture 61 Testing

Lecture 62 Exercise- InstallerHelper

Lecture 63 Refactoring InstallerHelper

Lecture 64 Testing InstallerHelper

Lecture 65 Exercise- EmployeeHelper

Lecture 66 Refactoring EmployeeController

Lecture 67 Testing EmployeeController

Section 7: Project- Testing BookingHelper

Lecture 68 Introduction

Lecture 69 Test Cases

Lecture 70 Extracting IBooking Repository

Lecture 71 Writing the First Test

Lecture 72 Refactoring

Lecture 73 Writing the Second Test

Lecture 74 Fixing a Bug

Lecture 75 Writing Additional Tests

Section 8: Project- HouseKeeperHelper

Lecture 76 Introduction

Lecture 77 Refactoring For Testability

Lecture 78 Fixing a Design Issue

Lecture 79 An Alternative Solution

Lecture 80 Writing the First Interaction Test

Lecture 81 Keeping Tests Clean

Lecture 82 Testing a Method is Not Called

Lecture 83 Another Interaction Test

Lecture 84 Extracting Helper Methods

Lecture 85 Testing Exceptions

Lecture 86 Coupons to My Other Courses

Anyone who wants to build better quality software with fewer bugs,Any developers who want to transition to the senior level

Course Information:

Udemy | English | 5h 48m | 2.78 GB
Created by: Mosh Hamedani

You Can See More Courses in the Developer >> Greetings from CourseDown.com

New Courses

Scroll to Top