I originally posted this post on my blog a couple of weeks ago.
In 2021, I switched from posting whenever I had an idea about anything to posting regularly every other week about some topics.
I wrote a whole series of posts about unit testing. From how to write your first unit test with MSTest to what stubs and mocks are. In fact, I wrote my first ebook Unit Testing 101 with some of the posts of the series. By the way, you can download it for free. No email asked.
These are the 5 posts I wrote in 2021 you read the most. In case you missed any of them, here they are:
- How to name your unit tests. 4 test naming conventions. This post is part of the Unit Testing 101 series. Four ideas to better name our unit tests. All of them, to write names easy to understand.
- What are fakes in unit testing: mocks vs stubs. Again, part of Unit Testing 101. This post shows what fakes, stubs, and mocks are. It might sound difficult, but it isn't.
- TIL: How to convert 2-digit year to 4-digit year in C#. Last year, I worked with a Stripe-powered payment module in a reservation management system. And, I needed to parse card expiration dates from a 2-digit year to a 4-digit year. I almost just added 2000 to them. But I didn't. This is what I found and did instead.
- Decorator pattern. A real example in C#. My favorite pattern. This post shows how to implement a retry mechanism on top of Stripe API client.
- A quick guide to LINQ with examples. I wrote this post to answer a friend. All you need to know to start working with LINQ in 15 minutes or less.
Voilà! These were your 5 favorite posts. Hope you enjoy them.
Stay tune to my blog. In the next months, I'm releasing a series of posts with what I've been learning about SQL Server performance tuning. And, I'm sticking to my "Monday Links" series: five interesting read about programming, careers, and learning every month.
Thanks for reading, and happy coding in 2022!