November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
Hello Zuf,
I assume you are implementing Headless with CMS PAAS in this case and that you're already familiar with Unit Testing for .NET core. I'm a big fan of unit testing my CMS implementations and my CMS AddOns.
If I can just give a few easy tips:
1. When testing search APIs, separate out the code that operates directly with the optimizely index code from your controllers and model building code. The Optimizely Search & Navigation index code is not unit test friendly and I suspect (but cannot verify yet) that the same applies for graph.
2. When unit testing with dependencies injected via ServiceLocator, you will have extra steps to set up the mocked dependencies, but you can achieve it like so:
var contentAreaLoader = new Mock<IContentAreaLoader>();
var serviceProvider = new Mock<IServiceProvider>();
serviceProvider.Setup(x => x.GetService(typeof(IContentAreaLoader))).Returns(contentAreaLoader.Object);
ServiceLocator.SetServiceProvider(serviceProvider.Object);
Hi,
Im new in the Optimizely world.
I need some ideas/examples for how to make some unit tests of our backend Headless project. The main purpose is to get some more test coverage of the code.
Br.
Zuf