Coffee => Coder => Code
Ramblings on code, Sitecore and stuff
Posts from 2020
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.
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.