# Unit Testing with MSTest

Tests prove your code does what you think it does, and keep proving it as the code changes. You will see where testing fits in the software development lifecycle, then plan and write unit tests with MSTest and try test-driven development.

Updated: November 3, 2026

## [SDLC](https://www.ask-codey.com/courses/csharp-full-stack-bootcamp/topics/csharp-sdlc)

1. [SDLC](https://www.ask-codey.com/lessons/sdlc) (Novice): The five phases of the software development lifecycle (requirements, design, code, test, deploy), and how Agile and test-driven development change their order.

## [Unit Testing with MSTest](https://www.ask-codey.com/courses/csharp-full-stack-bootcamp/topics/unit-testing-with-mstest)

1. [Unit Testing: an overview](https://www.ask-codey.com/lessons/unit-testing-an-overview) (Novice): What a unit test is, and why small classes with clear responsibilities can be tested on their own.
2. [The MSTest Framework](https://www.ask-codey.com/lessons/unit-testing-with-mstest-the-mstest-framework) (Apprentice): MSTest is Microsoft's testing framework for .NET. A test runner finds and runs your tests; a test class holds the tests for one class, in a test project of its own.
3. [Planning Unit Tests](https://www.ask-codey.com/lessons/unit-testing-with-mstest-planning-unit-tests) (Apprentice): Plan tests from the requirements, as a table of scenarios. Each scenario changes one thing, and the edges (at a limit, just inside it, just past it) find the most bugs.
4. [Adding Test Classes](https://www.ask-codey.com/lessons/unit-testing-with-mstest-adding-test-classes) (Apprentice): Add an MSTest test project beside your app, give it a reference to the app, and add a test class for each class you test.
5. [Writing Tests](https://www.ask-codey.com/lessons/unit-testing-with-mstest-writing-tests) (Apprentice): Name each test for its scenario, write it in three parts (Arrange, Act, Assert), check results with MSTest's Assert methods, and run one test for many inputs with DataRow.
6. [Test-Driven Development](https://www.ask-codey.com/lessons/unit-testing-with-mstest-test-driven-development) (Apprentice): In test-driven development you write a failing test first, then just enough code to pass it, then tidy up. Follow three short cycles that build a shipping calculator.

## [Exercise: Writing Unit Tests](https://www.ask-codey.com/courses/csharp-full-stack-bootcamp/topics/exercise-writing-unit-tests)

1. [Exercise: Writing Unit Tests](https://www.ask-codey.com/lessons/exercise-writing-unit-tests) (Apprentice): Three finished classes each hide one bug. Plan scenarios from their requirements, write MSTest tests that find the bugs, and fix the code.

Source: https://www.ask-codey.com/courses/csharp-full-stack-bootcamp/chapters/unit-testing-with-mstest
