Copied to clipboard

Flag this post as spam?

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


  • Chris Randle 85 posts 199 karma points c-trib
    Aug 26, 2024 @ 10:21
    Chris Randle
    0

    Testing extension methods for UmbracoBuilder

    I am in the process of adding unit tests to an Umbraco 13.4 site, retrospectively after completion. We need to test IUmbracoBuilder extension methods. So I am having problems trying to create an instance of UmbracoBuilder because of the constructor's parameter, one of which is a TypeLoader.

    Fortunately, in the source is a project called Umbraco.Tests.UnitTests that has a ComponentTests with a test called Boot1A. It creates a test harness for UmbracoBuilder using this (line 119 of tag Branch_release-13.4.0 ):

        var composition = new UmbracoBuilder(register, Mock.Of<IConfiguration>(), TestHelper.GetMockedTypeLoader());
    

    I want to use this test project, and I remember that the advice was to add references to the source code, but why do I have to do that now? Also which DLLs do I need to reference to get this TestHelper?

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies