From the course: C# Unit Testing with xUnit
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Using assertions and refactoring - C# Tutorial
From the course: C# Unit Testing with xUnit
Using assertions and refactoring
- [Instructor] In this video, we'll dive into the important role unit testing has during the modification and enhancement of existing code. Our focus will be on refactoring the add and subtract functions of our calculator to support multiple arguments. We'll verify these modifications work by writing corresponding unit tests. We'll start by writing a parameterized test for the enhanced add function that can accept multiple parameters, even though this functionality doesn't exist yet. (keyboard clicks) Let's start by creating a new theory. We'll use an inline data to pass in an array of integers as well as the value we expect them to be after we add them all up. We'll start with one, two, three, and six, and for the second test we'll create an inline data with an integer array containing 4, 5, 6 and 15. Now we'll create the new test called AddMultipleIntegers. We'll pass it in the array of numbers and an expected…