1 00:00:00,900 --> 00:00:05,230 Over the years, many tools have been developed to make unit testing easier. 2 00:00:05,230 --> 00:00:08,990 A unit test is simply a method that executes the code under test and 3 00:00:08,990 --> 00:00:11,870 checks to see if it got the expected results. 4 00:00:11,870 --> 00:00:15,400 We could do this right from the main method of a console application. 5 00:00:15,400 --> 00:00:17,630 However, after writing many unit tests, 6 00:00:17,630 --> 00:00:20,722 you'd start to see a pattern in how these tests are set up and run. 7 00:00:20,722 --> 00:00:25,520 You'd eventually create a framework that all of your unit tests can use. 8 00:00:25,520 --> 00:00:29,420 Fortunately, there are many such frameworks already available for .NET. 9 00:00:29,420 --> 00:00:31,735 There are three main frameworks. 10 00:00:31,735 --> 00:00:36,977 MSTest which is also known as the Visual Studio Unit Testing Framework, 11 00:00:36,977 --> 00:00:40,980 NUnit and xUnit.net. 12 00:00:40,980 --> 00:00:44,050 All three of these frameworks are based off of one of the first 13 00:00:44,050 --> 00:00:48,130 popular unit testing frameworks for Java called jUnit. 14 00:00:48,130 --> 00:00:50,670 They all work relatively the same, though. 15 00:00:50,670 --> 00:00:52,470 Together these frameworks and 16 00:00:52,470 --> 00:00:57,590 others like them are referred to as the xUnit family of unit test frameworks. 17 00:00:57,590 --> 00:01:02,500 Of these three frameworks for .NET, xUnit.net is the most popular and 18 00:01:02,500 --> 00:01:05,240 the one that has the most active development. 19 00:01:05,240 --> 00:01:07,650 It's also the one we'll be using in this course. 20 00:01:08,780 --> 00:01:13,140 You may work on projects that use one of the other frameworks and that's okay. 21 00:01:13,140 --> 00:01:15,900 Everything you'll learn in this course can be applied 22 00:01:15,900 --> 00:01:18,780 to any of this family of unit testing frameworks. 23 00:01:18,780 --> 00:01:24,100 That said you'll often hear me refer xUnit.net as just xUnit. 24 00:01:24,100 --> 00:01:27,440 Just know that I'm only referring to xUnit.net and 25 00:01:27,440 --> 00:01:29,210 not the family of frameworks as a whole. 26 00:01:30,240 --> 00:01:33,960 One great thing about unit testing frameworks is that they often work 27 00:01:33,960 --> 00:01:38,990 well with IDEs such as Visual Studio, which means we can execute, 28 00:01:38,990 --> 00:01:42,480 debug, and get the results of our unit test without leaving the IDE. 29 00:01:42,480 --> 00:01:46,902 To do that, we'll want to install an extension to Visual Studio. 30 00:01:46,902 --> 00:01:49,100 The Outercurve Foundation, 31 00:01:49,100 --> 00:01:52,510 which is one of the open source companies supported by Microsoft, 32 00:01:52,510 --> 00:01:58,050 has made using xUnit.net really easy by creating an extension to Visual Studio. 33 00:01:58,050 --> 00:02:01,910 This extension helps with generating test projects that come complete with 34 00:02:01,910 --> 00:02:04,750 everything we need to create and run tests. 35 00:02:04,750 --> 00:02:08,940 To install it, just click Tools, Extensions and Updates. 36 00:02:10,090 --> 00:02:12,204 Now over here click on Online. 37 00:02:13,644 --> 00:02:16,444 Over in the search box, just type in xunit. 38 00:02:18,204 --> 00:02:22,770 Here we see a number of extensions and templates that have to do with xUnit. 39 00:02:22,770 --> 00:02:27,160 The one we want is called xUnit.net Test Extensions. 40 00:02:27,160 --> 00:02:28,960 It's created by Outercurve Foundation. 41 00:02:30,910 --> 00:02:32,620 I just click Download here to install it. 42 00:02:35,110 --> 00:02:38,870 You may have to click the Restart Now button to restart Visual Studio to enjoy 43 00:02:38,870 --> 00:02:39,630 this extension. 44 00:02:41,160 --> 00:02:43,480 There we go, that's all we need to do. 45 00:02:43,480 --> 00:02:47,090 We'll take a closer look at what this extension does for us in the next video.