public void Constructor_Exception_NullStorageManager() { INavigationTarget navigationTarget = new MockNavigationTarget(); IViewFactory viewFactory = MockViewFactory.WithPageAndViewModel; ILifetimeManager lifetimeManager = new MockLifetimeManager(); IStorageManager storageManager = null; var e = Assert.Throws<ArgumentNullException>(() => new NavigationManager(navigationTarget, viewFactory, lifetimeManager, storageManager)); Assert.Equal("Value cannot be null.\r\nParameter name: storageManager", e.Message); Assert.Equal("storageManager", e.ParamName); }
public void DisplayPage_PassesNavigationManagerToNavigationTarget() { MockNavigationTarget navigationTarget = new MockNavigationTarget(); TestableNavigationManager navigationManager = CreateNavigationManager(navigationTarget: navigationTarget); object page = new object(); navigationManager.DisplayPage(page); Assert.Equal(new INavigationBase[] { navigationManager }, navigationTarget.NavigateToCalls.Select(c => c.Item2).ToArray()); }
// *** Private Methods *** private TestableNavigationManager CreateNavigationManager(INavigationTarget navigationTarget = null, IViewFactory viewFactory = null, INavigationStack navigationStack = null, ILifetimeManager lifetimeManager = null, IStorageManager storageManager = null, bool navigationTargetIsNull = false) { if (navigationTarget == null && !navigationTargetIsNull) navigationTarget = new MockNavigationTarget(); if (viewFactory == null) viewFactory = MockViewFactory.WithPageAndViewModel; if (navigationStack == null) navigationStack = new MockNavigationStack(); if (lifetimeManager == null) lifetimeManager = new MockLifetimeManager(); if (storageManager == null) storageManager = new MockStorageManager(); TestableNavigationManager navigationManager = new TestableNavigationManager(navigationTarget, viewFactory, navigationStack, lifetimeManager, storageManager); return navigationManager; }
public void NavigationTarget_SetViaConstructor() { MockNavigationTarget navigationTarget = new MockNavigationTarget(); TestableNavigationManager navigationManager = CreateNavigationManager(navigationTarget: navigationTarget); Assert.Equal(navigationTarget, navigationManager.NavigationTarget); }