Look inside
External services, databases, and other dependencies are hard to run in a predictable way and can often cause test failures when there is no issue in your code. In this liveProject, you’ll isolate unnecessary dependencies and replace them with mock objects that have more manageable behavior. You’ll then be able to develop isolated unit tests, which do not break due to external reasons, are easy to write and run, and have fast execution times.
This project is designed for learning purposes and is not a complete, production-ready application or solution.
prerequisites
This liveProject is for intermediate C# developers who want to improve their understanding of modern testing practices. No previous testing experience is required. To begin this liveProject, you will need to be familiar with:
TOOLS
- Intermediate C#
- Visual Studio: able to create new projects and install plugins, min. version 2019
- ASP.NET and web development, min. version .NET 5
- .NET desktop development
- .NET Core cross-platform development
- Basics of MongoDB
- Basics of Docker: able to run Docker and Docker Compose files from Visual Studio
- Basic YAML: able to read simple YAML files
- Basic REST and HTTP for creating web services
you will learn
In this project, you will learn to create robust unit tests by faking unreliable dependencies. You’ll use Moq to create, configure and investigate fake objects.
- What are fake objects
- How to use mocks, stubs, and fakes to improve your unit tests
- How fake objects work and their limitations
- How to use a mocking framework to create isolated and maintainable tests
- Mocking best practices to reduce the amount of code and work required when using Moq