Understanding unit testing
Unit tests test a unit of an application without external dependencies such as message queues, files, databases, web services, and so on. You can run hundreds of unit tests in just a few seconds because they are cheap to write and quick to execute, hence you can easily verify that each building block in your application is working as expected. Consequently, since you are not testing your class or components with their external dependencies, you can't gain a lot of confidence in your application's reliability. This is where integration tests come into play, which we will talk about later.
In my day-to-day work, I only write tests for complex code that is error-prone runtime code, complex code, and algorithmic logic, and then I put all my effort into integration tests. Anyway, I have other opinions about unit testing, but you will see these later. For now, let's start writing some unit tests using xUnit and FluentAssertions
.