Prism makes it easy to use dependency injection and keep our apps modular. This modularity is great for testing, but all that dependency injection magic can make our test code seem more complex and filled with a lot of ceremony just to create a testable instance of a ViewModel and its dependencies. I’ve learned to embrace magic and I’ll share tips on how to take advantage of the same IoC container strategy used at runtime to make instantiating the class we want to test less painful. We’ll tap into the life-cycle or our unit testing framework and combine a mocking framework and a custom lifetime manager for our IoC container to make sure each test has clean dependencies and keep us from ever directly instantiating our ViewModels or dependencies again. A great side-effect is that our tests become more resilient against changing dependencies that do not concern the test. Skip all the setup ceremony and get straight to the actual test.