Exemple #1
0
        public void StateTest()
        {
            var screen = new MockScreen();

            Assert.AreEqual(LifecycleState.Undefined, screen.State);
            Assert.False(screen.IsActive);

            screen.Close();
            Assert.AreEqual(LifecycleState.Undefined, screen.State);
            Assert.False(screen.IsActive);

            screen.Activate();
            Assert.AreEqual(LifecycleState.Active, screen.State);
            Assert.True(screen.IsActive);

            screen.Deactivate();
            Assert.AreEqual(LifecycleState.Inactive, screen.State);
            Assert.False(screen.IsActive);

            screen.Close();
            Assert.AreEqual(LifecycleState.Closed, screen.State);
            Assert.False(screen.IsActive);

            screen.Activate();
            Assert.AreEqual(LifecycleState.Closed, screen.State);
            Assert.False(screen.IsActive);

            screen.Deactivate();
            Assert.AreEqual(LifecycleState.Closed, screen.State);
            Assert.False(screen.IsActive);
        }
Exemple #2
0
        public void OnClosedTest()
        {
            var screen = new MockScreen();

            Assert.AreEqual(0, screen.OnClosedCalledCount);

            screen.Close();
            Assert.AreEqual(0, screen.OnClosedCalledCount);

            screen.Deactivate();
            screen.Close();
            Assert.AreEqual(0, screen.OnClosedCalledCount);

            screen.Activate();
            screen.Close();
            Assert.AreEqual(1, screen.OnClosedCalledCount);

            screen.Close();
            Assert.AreEqual(1, screen.OnClosedCalledCount);

            screen.Activate();
            screen.Deactivate();
            screen.Close();
            Assert.AreEqual(1, screen.OnClosedCalledCount);
        }