Intro to Unit Testing in C# using XUnit

Intro to Unit Testing in C# using XUnit

430.588 Lượt nghe
Intro to Unit Testing in C# using XUnit
Unit testing is an important part of writing quality software. It is also a controversial and somewhat difficult topic to get started in. In this video, we walk through why we would use unit testing, what a unit test is, how to create a test, and how to deal with some of the more difficult situations. Along the way, we will cover best practices, the pitfalls to avoid, and how to write more testable code. This video uses XUnit instead of NUnit or MSTest based upon my preference. However, the techniques taught will apply to other test types. Newsletter signup (with exclusive discounts): https://signup.iamtimcorey.com/ (your email will be kept safe and you will not be spammed). Source Code (and homework): https://leadmagnets.app/?Resource=IntroToUnitTesting 0:00 - Intro 1:37 - Working environment 3:35 - Demo application walk-through 7:14 - Unit Testing explained 9:45 - Creating a Unit Test project 13:22 - Setting up a test 22:37 - A bad Unit Test and Test Driven Development 25:48 - Opinion on Unit Testing 28:40 - Shortening Test name 31:08 - "Theory": Test method parameters and arguments 36:09 - Testing edge cases 38:43 - Testing number division 43:13 - Dividing by zero 48:55 - Testing methods that can throw exceptions: method returns output 54:14 - Debugging the Unit Test 55:19 - Testing the exceptions: method throws exception 59:22 - Testing the exceptions: method argument throws exception 1:05:07 - Testing methods that do more than one thing: what is a Unit of work? 1:10:56 - Breaking method in to individual methods, what to test and what not to test 1:18:50 - "Add to List" Tests: working test 1:26:50 - "Add to List" Tests: failing test 1:35:37 - Homework 1:40:05 - Concluding remarks