REFACTORING UNIT TESTS in ASP NET Core | Getting Started With ASP.NET Core Series



REFACTORING UNIT TESTS in ASP NET Core | Getting Started With ASP.NET Core Series

REFACTORING UNIT TESTS in ASP NET Core | Getting Started With ASP.NET Core Series

Hello Friends, Writing maintainable and robust unit tests is hard. Often when making changes to our main code a lot of tests break, making it hard to refactor and update code. We also avoid writing tests for the same reasons. Setting up test data can also be painful and makes tests less maintainable.

In this video, I will walk you through a refactoring exercise of making tests more maintainable and robust. I use existing tests from Microsoft documentation examples and walk through the existing issues and how to make them better.

00:00 Introduction
02:45 – Common Problems
06:00 – AutoFixture Introduction & Setup
07:38 – Automatic Data Setup
13:18 – Domain-Specific Data Setup
25:15 – Enumerable Test Data
27:57 – Mocking Dependencies

Additional Watching
📹 AutoFixture Series – https://www.youtube.com/playlist?list=PL59L9XrzUa-mItWClbGuMEK5oQpU2onCq
📹ASP NET Core Series – https://www.youtube.com/playlist?list=PL59L9XrzUa-nqfCHIKazYMFRKapPNI4sP
📹Logging – https://youtu.be/dxBlBltEDRs

LInks
🔗 AutoFixture – https://autofixture.github.io/
🔗Refactored Source Code – https://rahulpnath.visualstudio.com/DefaultCollection/YouTube%20Samples/_git/refactor-unit-tests
🔗Unit Tests – https://docs.microsoft.com/en-us/aspnet/core/mvc/controllers/testing?view=aspnetcore-5.0&WT.mc_id=AZ-MVP-5003875
🔗 Don’t Let Entity Framework Fool Your Constructors – https://www.rahulpnath.com/blog/dont-let-ef-fool-your-constructors/

Come say hi! ✋
🌍 Blog – https://rahulpnath.com/
✉ Subscribe to my Newsletter – https://www.rahulpnath.com/subscribe
🐦Twitter – https://twitter.com/rahulpnath
📸Instagram – https://www.instagram.com/rahulpnath/

🎥 Recording Setup and Workflow – https://www.rahulpnath.com/blog/youtube_setup_and_workflow/

Make sure to SUBSCRIBE to the channel. THANK YOU for helping me grow this channel !!

Comments are closed.