public void CanCloseWithNullProjectFacade() { Func <string, IDisposable> func = s => new MockDisposable(); var command = new CloseProjectCommand(null, func); Assert.IsFalse(command.CanExecute(null)); }
public void CanCloseWithProjectThatCannotBeUnloaded() { var project = new Mock <ILinkToProjects>(); { project.Setup(p => p.CanUnloadProject()) .Returns(false); } Func <string, IDisposable> func = s => new MockDisposable(); var command = new CloseProjectCommand(project.Object, func); Assert.IsFalse(command.CanExecute(null)); }
public void CloseProject() { var project = new Mock <ILinkToProjects>(); { project.Setup(p => p.CanUnloadProject()) .Returns(true); project.Setup(p => p.UnloadProject()) .Verifiable(); } Func <string, IDisposable> func = s => new MockDisposable(); var command = new CloseProjectCommand(project.Object, func); Assert.IsTrue(command.CanExecute(null)); command.Execute(null); project.Verify(p => p.UnloadProject(), Times.Once()); }