Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Lachlan Ridley 2 posts 71 karma points
    Mar 06, 2024 @ 03:25
    Lachlan Ridley
    0

    Injecting IPublishedContentQuery during an integration test throws an exception

    I'm trying to write some integration tests for my event handlers. I've added the integration testing nuget package to my project and set everything up as described in the documentation (https://docs.umbraco.com/umbraco-cms/implementation/integration-testing).

    The issue is whenever I try and get IPublishedContentQuery (either through GetRequiredService or through another dependency's constructor) an exception is thrown: "System.InvalidOperationException : Wasn't able to get an UmbracoContext".

    What am I missing? Thanks!

Please Sign in or register to post replies

Write your reply to:

Draft