Copied to clipboard

Flag this post as spam?

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


  • Julien Kulker 51 posts 274 karma points c-trib
    Feb 05, 2019 @ 15:24
    Julien Kulker
    0

    what are my options to mock AncestorOrSelf method?

    Hi all,

    I am just starting with unit test my code. This article i used to setup my base: https://skrift.io/articles/archive/unit-testing-umbraco-with-umbraco-context-mock/

    The problem is i use the AncestorOrSelf method and that method is not mockable.

    What i can do is make a libaryclass that has a public method and calls the AncestorOrself method.

    But that feels that i just move the problem.

    Hope you guys can help me out

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Feb 05, 2019 @ 16:06
    Alex Skrypnyk
    0

    Hi Julien,

    I wouldn't suggest mocking Umbraco methods :)

  • Julien Kulker 51 posts 274 karma points c-trib
    Feb 06, 2019 @ 08:30
    Julien Kulker
    0

    Well if i use them in my codebase i have to mock the methods or not use them. And not use them is no option.

  • louisjrdev 107 posts 343 karma points c-trib
    Feb 08, 2019 @ 09:39
    louisjrdev
    0

    I would suggest reaching out to Gary himself:

    https://twitter.com/garydevenay

    Then maybe add a PR to the documentation

  • almanZT 9 posts 90 karma points
    Sep 13, 2019 @ 10:02
    almanZT
    0

    has anyone solved this, am having the same issues ?

  • 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