This course will help you gain a better understanding of unit testing with good patterns to follow and an understanding of patterns to avoid. You'll see how to avoid patterns that lead to brittle tests that impede refactoring your code.
Creating effective C# unit tests for enterprise applications requires thoughtful consideration so that your test suite doesn't become burdensome from being rote, brittle, and untrustworthy. In this course, Effective C# Unit Testing for Enterprise Applications, you'll learn techniques to create unit tests that are readable, risk-driven, and resilient to refactoring. You'll learn how to create maintainable unit tests by examining three pillars of effective unit tests. First, unit tests need to be clear and simple and emphasize readability. Second, unit tests should provide the highest value by focusing on validating your most important and complicated code. Lastly, you're test must stay flexible by knowing as few details about your production code as possible. By the end of this course, you'll see a new perspective on unit testing that emphasizes thoughtful unit testing.
Rusty Divine is technical lead, presenter, and blogger who lives in Nebraska and works with a happy team of agile developers. Rusty specializes in .Net web applications for businesses and enjoys working with customers and stakeholders, coaching developers, and grilling gourmet burgers.
Course Overview Hi everyone, my name is Rusty Divine and welcome to my course Effective C# Unit Testing for Enterprise Applications. I am a software consultant in Nebraska and I've been working with the Microsoft stack of technologies for over 15 years. During that time I have experienced many different styles of unit testing and have written some pretty brittle unit tests. I know this course can help you avoid some of the pitfalls I found along the way, so that you start enjoying and maintaining your unit test and trusting that they are validating your production code. You will learn how to create maintainable unit tests in this course by examining three pillars of effective unit tests. Unit tests need to be clear and simple and emphasize readability. They should provide the highest value by focusing on validating your most important and complicated code and a test must stay flexible by knowing as few details about your production code as possible. By the end of this course, you'll see a new perspective on unit testing that emphasizes thoughtful unit testing over rote processor metrics and will challenge you to change the way you think about unit testing from a test-by-methods style to a test-by-scenario style. This is an intermediate level course and does not cover the basics of how to unit test. You should be familiar with unit test classes, methods and runners before you begin this course. This course uses an example in Tier Enterprise application that emphasizes interfaces and dependency injection. If you have some exposure to this architectural style, you'll have no problem following along. Otherwise, I would encourage you to search for the terms in Tier and dependency injection here on Pluralsight or on the web to familiarize yourself before beginning this course. I hope you'll join me on this journey to learn how to enjoy unit testing with the Effective C# Unit Testing for Enterprise Applications course at Pluralsight.
Creating High Value Tests That Cover Your Riskiest Code How do you know when you have written too many tests? Do you have so many tests that your team groans when they have to maintain them, or are actively avoiding refactoring code because they know it would mean fixing so many tests too? Different teams and different projects will need to develop their own philosophy on what to test and where to draw the line. In this module, I'll show you how to think about your tests and how each test falls within a spectrum of usefulness. Some tests are critical, others may just be getting in your way, but it'll be up to you and your team to decide where to draw that line. You are going to see how I like to think about unit testing to help me decide where to focus my test coverage and where I might skip testing all together. But even if you don't write a single test for your project, you should write your code in a way that is testable, because it will lead to less brittle code that will be easier to read and maintain, and therefore, will end up saving you time over the life of your project. I'm going to show you how to think about your code in terms of risk, for where logical errors could hide, or where business-critical decisions are based. These are areas where you will want to focus a lot of tests that cover the myriad of scenarios that could be input into your system. Instead of making an arbitrary rule, like we will have 100% test coverage or 70%, or whatever, I'll show you how to think about the value of the tests you are creating so you know where to focus more testing, and where you might not need any coverage whatsoever.