Table of Contents

Class FakeNavigationManager

Namespace
Bunit.TestDoubles
Assembly
Bunit.Web.dll

Represents a fake NavigationManager that captures calls to NavigateTo(string, bool) for testing purposes.

public sealed class FakeNavigationManager : NavigationManager
Inheritance
FakeNavigationManager
Inherited Members
Extension Methods

Constructors

FakeNavigationManager(TestContextBase)

Initializes a new instance of the FakeNavigationManager class.

public FakeNavigationManager(TestContextBase testContextBase)

Parameters

testContextBase TestContextBase

Properties

History

The navigation history captured by the FakeNavigationManager. This is a stack based collection, so the first element is the latest/current navigation target.

public IReadOnlyCollection<NavigationHistory> History { get; }

Property Value

IReadOnlyCollection<NavigationHistory>

Remarks

The initial Uri is not added to the history.

Methods

HandleLocationChangingHandlerException(Exception, LocationChangingContext)

Handles exceptions thrown in location changing handlers.

protected override void HandleLocationChangingHandlerException(Exception ex, LocationChangingContext context)

Parameters

ex Exception

The exception to handle.

context LocationChangingContext

The context passed to the handler.

NavigateToCore(string, NavigationOptions)

Navigates to the specified URI.

protected override void NavigateToCore(string uri, NavigationOptions options)

Parameters

uri string

The destination URI. This can be absolute, or relative to the base URI (as returned by BaseUri).

options NavigationOptions

Provides additional NavigationOptions.

NavigateToCore(string, bool)

Navigates to the specified URI.

protected override void NavigateToCore(string uri, bool forceLoad)

Parameters

uri string

The destination URI. This can be absolute, or relative to the base URI (as returned by BaseUri).

forceLoad bool

If true, bypasses client-side routing and forces the browser to load the new page from the server, whether or not the URI would normally be handled by the client-side router.

SetNavigationLockState(bool)

Sets whether navigation is currently locked. If it is, then implementations should not update Uri and call NotifyLocationChanged(bool) until they have first confirmed the navigation by calling NotifyLocationChangingAsync(string, string, bool).

protected override void SetNavigationLockState(bool value)

Parameters

value bool

Whether navigation is currently locked.

Progress Telerik

Premium sponsor: Progress Telerik.

Packt

Editorial support provided by Packt.

.NET Foundation

Supported by the .NET Foundation.