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.
Creating addition and subtraction logic - C# Tutorial
From the course: C# Unit Testing with xUnit
Creating addition and subtraction logic
- In this video we're going to create a calculator. It's going to have an add and subtract function. In order to make sure that these functions work as expected we're going to leverage the arrange, act and assert pattern. As a reminder, arrange means that we prepare the test, act means that we execute the functionality we want to test and assert means that we compare the actual result with the expected result. Let's get started by creating a new test class. We can close out the old test class that we were using previously and right click on the project and create a new class. We're going to call this calcTests. Now we're going to start by adding a test for the ad function that doesn't exist yet. This fits with the red phase of the red, green refactor cycle where we write tests that initially fail. Let's call our first test AddTwoIntegers. In the arrange step, we're going to create a new reference to the calculator, which we've…