This is the final post in my "Unit Testing Sitecore Components" series. In this series I've taken a seemingly simplistic Sitecore component and refactored it by applying several principals to make the code more reusable and testable. In this final post of the series I'll recap the principals and provide a few resources to help explain them further.
In the previous posts of this series, I've refactored an existing Sitecore component to make it's logic more reusable and prepare the component and the logic it includes for unit testing. In this post I'll be writing the unit tests for the refactored EntryTaxonomy class, showing how to mock items and field values.
WeBlog 4.1 has been released. The main feature of WeBlog 4.1 is support for Sitecore 10.0. You'll find the Sitecore packages for various Sitecore versions on the release page at https://github.com/WeTeam/WeBlog/releases/tag/release%2F4.1.
In the posts of this series so far, I've refactored a sample view rendering to make the rendering itself unit testable. In doing do I've extracted the business logic to a separate class which still needs some work before it can be properly tested. In this post, I'll be covering 2 more principals to help with making Sitecore components more testable and reusable.
In the previous post of this series I detailed 2 principals which can help with making Sitecore components more testable and reusable. These were "keeping the business logic out of the view" and "keeping the Item class out of the model". In this post I'll detail several more principals to continue improving the code.
At the end of April (2020), I had the great pleasure of presenting at the virtual SUGCON conference online. My presentation was a live walkthrough showing how to unit test a Sitecore component. In the presentation I utilised many principals to refactor and improve a view rendering.
WeBlog 4.0 and 4.0.1 have been released. Version 4.0.1 is a bugfix release, so it's recommended to use that over the 4.0 release. You'll find the Sitecore packages for various Sitecore versions on the release page at https://github.com/WeTeam/WeBlog/releases/tag/release%2F4.0.1.