/// <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); }
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()); }
public void CanShutdownWithNullApplication() { var command = new ExitCommand(null); Assert.IsFalse(command.CanExecute(null)); }