Unit Testing

Introduction

We’re almost there! It’s been a long way and it’s almost time to celebrate your graduation from the Console Apps area. But there’s one final step: Unit Tests.

More likely than not (and hopefully) the organisation you’ll work will have systems that use automatic unit testing. They make sure everything is running properly before each deployment. The code covered by those tests won’t need to be tested manually every time a change is made, which is prone to errors and very expensive. A strong suite of unit tests helps developers write better code, more efficiently. So let's do it!

Requirements

  • In this project, you'll create unit tests for the Coding Tracker App, the second project in the course
  • You'll need to create a CodingTracker.Tests project, parallel to your coding tracker and reference it in your csproj file
  • You'll only test the validation methods, making sure the app correctly prevents the user from giving incorrect inputs
  • You should use .NETs MSTest Library
  • You should test both correct and incorrect inputs

Resources

Here are a few resources that might be helpful.

Tips

  • Don't worry about integration or end-to-end tests, they're out of the scope of this project
  • Make sure the names of your tests are clear, even if they have to be long. "WhenQuantityInputIsCorrect()" is a good name, while "QuantityTest" doesn't have enough information.
  • In your test, you'll have to mock the tested service and call it's methods. Think of all possibilities of correct and incorrect inputs and test if the application handles them.

Introduction

We’re almost there! It’s been a long way and it’s almost time to celebrate your graduation from the Console Apps area. But there’s one final step: Unit Tests.

More likely than not (and hopefully) the organisation you’ll work will have systems that use automatic unit testing. They make sure everything is running properly before each deployment. The code covered by those tests won’t need to be tested manually every time a change is made, which is prone to errors and very expensive. A strong suite of unit tests helps developers write better code, more efficiently. So let's do it!

Requirements

  • In this project, you'll create unit tests for the Coding Tracker App, the second project in the course
  • You'll need to create a CodingTracker.Tests project, parallel to your coding tracker and reference it in your csproj file
  • You'll only test the validation methods, making sure the app correctly prevents the user from giving incorrect inputs
  • You should use .NETs MSTest Library
  • You should test both correct and incorrect inputs

Resources

Here are a few resources that might be helpful.

Tips

  • Don't worry about integration or end-to-end tests, they're out of the scope of this project
  • Make sure the names of your tests are clear, even if they have to be long. "WhenQuantityInputIsCorrect()" is a good name, while "QuantityTest" doesn't have enough information.
  • In your test, you'll have to mock the tested service and call it's methods. Think of all possibilities of correct and incorrect inputs and test if the application handles them.
An error has occurred. This application may no longer respond until reloaded. Reload 🗙