This series will cover details about how to design ASP.NET Core MVC and Web API applications for unit testability. We will start with learning details about unit testing i.e. what is unit testing, why do we need unit testing and how to get started with unit testing in ASP.NET Core based applications.
Though we are covering unit testing with the .NET core you should be able to able to use unit testing concepts in full .NET framework as well.
I will even try to elaborate on the concepts we will be using to implement unit testing like we might use some design patterns for unit testing so will try to provide an explanation for those design patterns as well.
Prerequisites
- Visual Studio – I will be using visual studio 2019 community edition with .NET 5
- Knowledge of basic C# programming, ASP.NET Core MVC & Web API applications
Unit Testing in ASP.NET Core with xUnit.net
We will be using xUnit.net for this series to demonstrate the implementation of unit testing in ASP.NET Core applications.
xUnit.net is a free, open source, community-focused unit testing tool for the .NET Framework. Written by the original inventor of NUnit v2, xUnit.net is the latest technology for unit testing C#, F#, VB.NET and other .NET languages.
source – https://xunit.net/
The xUnit.net framework library allows us to create automated tests for both .NET Framework & .NET Core Framework so whatever we learn in context on .NET Core should apply to .NET framework as well.
XUnit.net is selected as it follows a modern & unique approach for unit testing and is highly extensible which allows you to have control over how tests are executed.
If you are interested in reading about comparison between xUnit.net and other frameworks then you can get the details from this link – xUnit.net comparison with other frameworks
So if you want to learn about how to design or build unit-testable ASP.NET Core MVC & Web API applications using xUnit.net i.e. to learn to write great unit tests then you need to either bookmark this series page (as I will update below list of articles which will be part of this series) or subscribe to my blog newsletter for updates in your mailbox.
Let’s Get Started
You can also check my other series on ASP.NET Core Security