Exemplo n.º 1
0
        public void CanCloseWithNullProjectFacade()
        {
            Func <string, IDisposable> func = s => new MockDisposable();

            var command = new CloseProjectCommand(null, func);

            Assert.IsFalse(command.CanExecute(null));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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());
        }