TestShutdownApp() public method

public TestShutdownApp ( ) : void
return void
示例#1
0
        public void AppExceptionHandlerShutdownAppExpectedShouldRestartIsFalse()
        {
            //Initialize
            var aggregator = new Mock <IEventAggregator>();

            aggregator.Setup(c => c.Publish(It.IsAny <SaveAllOpenTabsMessage>())).Verifiable();

            var mockApp = new Mock <IApp>();

            mockApp.Setup(c => c.Shutdown()).Verifiable();
            mockApp.SetupProperty(c => c.ShouldRestart);

            var mainViewModel = new Mock <IMainViewModel>();

            //Execute
            var handler = new MockExceptionHandler(mockApp.Object, mainViewModel.Object);

            handler.TestShutdownApp();

            //Assert
            Assert.IsFalse(mockApp.Object.ShouldRestart, "App did restart after non critical exception");
            mockApp.Verify(c => c.Shutdown(), "App did not shutdown after non critical exception");
        }
        public void AppExceptionHandlerShutdownAppExpectedShouldRestartIsFalse()
        {
            //Initialize
            var aggregator = new Mock<IEventAggregator>();
            aggregator.Setup(c => c.Publish(It.IsAny<SaveAllOpenTabsMessage>())).Verifiable();

            var mockApp = new Mock<IApp>();
            mockApp.Setup(c => c.Shutdown()).Verifiable();
            mockApp.SetupProperty(c => c.ShouldRestart);

            var mainViewModel = new Mock<IMainViewModel>();

            //Execute
            var handler = new MockExceptionHandler(mockApp.Object, mainViewModel.Object);
            handler.TestShutdownApp();

            //Assert            
            Assert.IsFalse(mockApp.Object.ShouldRestart, "App did restart after non critical exception");
            mockApp.Verify(c => c.Shutdown(), "App did not shutdown after non critical exception");
        }