public void TestTwoScreens() { var ss = new ScreenStack(); Assert.AreEqual(null, ss.CurrentScreen); var screen1 = new Screen(); var screen2 = new Screen(); ss.Push(screen1); ss.Update(0); Assert.AreSame(screen1, ss.CurrentScreen); screen1.Push(screen2); ss.Update(0); Assert.AreSame(screen2, ss.CurrentScreen); ss.Pop(); ss.Update(0); Assert.AreSame(screen1, ss.CurrentScreen); ss.Pop(); ss.Update(0); Assert.AreEqual(null, ss.CurrentScreen); Assert.Throws <InvalidOperationException>(ss.Pop); }
public void PopScreenWhenEmptyTest() { // - Arrange var screenStack = new ScreenStack(); // - Act & Assert Assert.Throws <InvalidOperationException>( () => screenStack.Pop()); }
public void TestOneScreen() { var ss = new ScreenStack(); Assert.AreEqual(null, ss.CurrentScreen); var screen = new Screen(); ss.Push(screen); ss.Update(0); Assert.AreSame(screen, ss.CurrentScreen); ss.Pop(); ss.Update(0); Assert.AreEqual(null, ss.CurrentScreen); }
public void Apply(Navigator navigator, ScreenStack screens) { var screen = screens.FirstOrDefault(e => e.GetType() == _screenType); if (screen is null) { throw new ScreenNotFoundException(_screenType); } while (screens.CurrentScreen != screen) { screens.Pop(); } navigator.BackToScreen(screen); }
public void PopScreenTest() { // - Arrange var screenA = new Mock <Screen>().Object; var screenB = new Mock <Screen>().Object; var screenStack = new ScreenStack(); screenStack.Push(screenA, screenB); // - Act var removedScreen = screenStack.Pop(); // - Assert Assert.IsTrue(screenStack.IsRoot); Assert.AreSame(screenA, screenStack.CurrentScreen); Assert.AreSame(screenB, removedScreen); CollectionAssert.DoesNotContain(screenStack, screenB); Assert.AreEqual(1, screenStack.Count); }
public void Apply(Navigator navigator, ScreenStack screens) { screens.Pop(); screens.Push(_screen); navigator.Replace(_screen, _resolver); }
public void Apply(Navigator navigator, ScreenStack screens) { screens.Pop(); navigator.Back(); }