Example #1
0
        /// <summary>
        /// Handles the window closing event.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.ComponentModel.CancelEventArgs"/> instance containing the event data.</param>
        private void HandleShellClosing(object sender, CancelEventArgs e)
        {
            var canExit = m_ExitCommand.CanExecute(null);

            if (!canExit)
            {
                e.Cancel = true;
                return;
            }

            m_ExitCommand.Execute(null);
        }
Example #2
0
        public void Shutdown()
        {
            var application = new Mock<IAbstractApplications>();
            {
                application.Setup(a => a.Shutdown())
                    .Verifiable();
            }

            var command = new ExitCommand(application.Object);
            Assert.IsTrue(command.CanExecute(null));
            command.Execute(null);

            application.Verify(a => a.Shutdown(), Times.Once());
        }
Example #3
0
 public void CanShutdownWithNullApplication()
 {
     var command = new ExitCommand(null);
     Assert.IsFalse(command.CanExecute(null));
 }