Search code examples
xamarin.formsnavigationmockingprismstatic-methods

NavigationParameters - GetNavigationMode() is NULL while mocking NavigationParameters.


I tried mocking NavigationParameters and it is setting GetNavigationMode() as NULL. Is there any better way to mock an extension method?


Solution

  • This was bugging me for a while as well, and I finally found something that is at least a workaround. This issue shows that you can actually add internal parameters to the NavigationParameters, it just doesn't show up in intellisense. My test code ended up looking something like:

    var navParams = new NavigationParameters();
    navParams.AddInternalParameter("__NavigationMode", NavigationMode.Back);
    

    Hope this helps!