Exemplo n.º 1
0
        public void ViewInWindowsCommand()
        {
            ISelectionContext selC = SelectionContextMock.EmptyContext();

            using (ServiceProviderHelper.AddService(typeof(ISelectionContext), selC))
            {
                Assert.That(CommandTester.TestExecution(AnkhCommand.ViewInWindows), Is.False);
            }
        }
Exemplo n.º 2
0
        public void RemoveWorkingCopyRoot()
        {
            ISelectionContext selC = SelectionContextMock.EmptyContext();

            using (ServiceProviderHelper.AddService(typeof(ISelectionContext), selC))
            {
                Assert.That(CommandTester.TestExecution(AnkhCommand.RemoveWorkingCopyExplorerRoot), Is.False);
            }
        }
Exemplo n.º 3
0
        public void UpdateItemCommand()
        {
            ISelectionContext selC = SelectionContextMock.EmptyContext();

            using (ServiceProviderHelper.AddService(typeof(ISelectionContext), selC))
            {
                Assert.That(CommandTester.TestExecution(AnkhCommand.UpdateItemSpecific), Is.False);
            }
        }
Exemplo n.º 4
0
        public void MakeDirectoryCommand()
        {
            ISelectionContext selC = SelectionContextMock.EmptyContext();

            using (ServiceProviderHelper.AddService(typeof(ISelectionContext), selC))
            {
                Assert.That(CommandTester.TestExecution(AnkhCommand.NewFolder), Is.False);
            }
        }
Exemplo n.º 5
0
        public void CopyReposExplorerUrl()
        {
            ISelectionContext selC = SelectionContextMock.EmptyContext();

            using (ServiceProviderHelper.AddService(typeof(ISelectionContext), selC))
            {
                Assert.That(CommandTester.TestExecution(AnkhCommand.CopyReposExplorerUrl), Is.False);
            }
        }
Exemplo n.º 6
0
        public void DiffLocalItem()
        {
            ISelectionContext selC = SelectionContextMock.EmptyContext();

            using (ServiceProviderHelper.AddService(typeof(ISelectionContext), selC))
            {
                Assert.That(CommandTester.TestExecution(AnkhCommand.DiffLocalItem), Is.False);
            }
        }
Exemplo n.º 7
0
        public void AddWorkingCopyExplorerRootCommandWithPath()
        {
            ISelectionContext selC = SelectionContextMock.EmptyContext();

            using (ServiceProviderHelper.AddService(typeof(ISelectionContext), selC))
            {
                Assert.IsTrue(CommandTester.TestExecution(AnkhCommand.WorkingCopyBrowse, Path.GetTempPath()));
            }
        }
Exemplo n.º 8
0
        public void AddItem()
        {
            ISelectionContext selC = SelectionContextMock.EmptyContext();

            using (ServiceProviderHelper.AddService(typeof(ISelectionContext), selC))
            {
                Assert.IsFalse(CommandTester.TestExecution(AnkhCommand.AddItem), "Add disabled with empty selection");
            }
        }
Exemplo n.º 9
0
        public void RevertItemCommand()
        {
            ISelectionContext selC = SelectionContextMock.EmptyContext();

            using (ServiceProviderHelper.AddService(typeof(ISelectionContext), selC))
            {
                Assert.That(CommandTester.TestExecution(AnkhCommand.RevertItem), Is.False,
                            "Cannot revert empty selection");
            }
        }
Exemplo n.º 10
0
        public void Refresh()
        {
            ISelectionContext selC = SelectionContextMock.EmptyContext();

            using (ServiceProviderHelper.AddService(typeof(ISelectionContext), selC))
            {
                Assert.That(CommandTester.TestExecution(AnkhCommand.Refresh), Is.True,
                            "Refresh works with empty selection");
            }
        }
Exemplo n.º 11
0
        public void CommitItemCommand()
        {
            ISelectionContext selC = SelectionContextMock.EmptyContext();

            using (ServiceProviderHelper.AddService(typeof(ISelectionContext), selC))
            {
                Assert.That(CommandTester.TestExecution(AnkhCommand.CommitItem), Is.False,
                            "Commit doesn't run without selection");
            }
        }
Exemplo n.º 12
0
        public void CheckoutCommand()
        {
            ISelectionContext selC = SelectionContextMock.EmptyContext();

            using (ServiceProviderHelper.AddService(typeof(ISelectionContext), selC))
            {
                Assert.That(CommandTester.TestExecution(AnkhCommand.Checkout), Is.False,
                            "Checkout doesn't execute with empty selection");
            }
        }
Exemplo n.º 13
0
        public void BlameCommand()
        {
            ISelectionContext selC = SelectionContextMock.EmptyContext();

            using (ServiceProviderHelper.AddService(typeof(ISelectionContext), selC))
            {
                Assert.That(CommandTester.TestExecution(AnkhCommand.ItemAnnotate), Is.False,
                            "Blame with empty selection doesn't execute");
            }
        }
Exemplo n.º 14
0
        public void ShowCommitDialog()
        {
            var state = new Mock <IAnkhCommandStates>();

            state.SetupGet(x => x.SccProviderActive).Returns(true);

            var uiShell = new Mock <SVsUIShell>().As <IVsUIShell>();

            using (ServiceProviderHelper.AddService(typeof(SVsUIShell), uiShell.Object))
                using (ServiceProviderHelper.AddService(typeof(IAnkhCommandStates), state.Object))
                {
                    Assert.That(CommandTester.TestExecution(AnkhCommand.ShowPendingChanges), Is.True);
                }
        }
Exemplo n.º 15
0
        public void Initialize()
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            // Create the package
            IVsPackage package = new AnkhSvnPackage() as IVsPackage;

            Assert.IsNotNull(package, "The object does not implement IVsPackage");

            var statusCache = new Mock <ISvnStatusCache>();
            var regEditors  = new Mock <SVsRegisterEditors>().As <IVsRegisterEditors>();

            var    vsShell = new Mock <SVsShell>().As <IVsShell>();
            object r       = @"SOFTWARE\Microsoft\VisualStudio\8.0";

            vsShell.Setup(x => x.GetProperty((int)__VSSPROPID.VSSPROPID_VirtualRegistryRoot, out r)).Returns(VSErr.S_OK);

            var vsTextMgr = new Mock <SVsTextManager>().As <IVsTextManager>();

            var monitorSelection = new Mock <IVsMonitorSelection>();

            var olMgr = new Mock <SOleComponentManager>().As <IOleComponentManager>();

            var outputWindow = new Mock <SVsOutputWindow>().As <IVsOutputWindow>();

            ServiceProviderHelper.AddService(typeof(IAnkhPackage), package);
            ServiceProviderHelper.AddService(typeof(SVsOutputWindow), outputWindow.Object);
            ServiceProviderHelper.AddService(typeof(SOleComponentManager), olMgr.Object);
            ServiceProviderHelper.AddService(typeof(IVsMonitorSelection), monitorSelection.Object);
            ServiceProviderHelper.AddService(typeof(SVsTextManager), vsTextMgr.Object);
            ServiceProviderHelper.AddService(typeof(SVsShell), vsShell.Object);
            ServiceProviderHelper.AddService(typeof(SVsRegisterEditors), regEditors.Object);
            ServiceProviderHelper.AddService(typeof(ISvnStatusCache), statusCache.Object);

            var uiService = new Mock <IUIService>();

            uiService.Setup(x => x.ShowDialog(It.IsAny <Form>())).Returns(DialogResult.OK);

            ServiceProviderHelper.AddService(typeof(IUIService), uiService.Object);
        }
Exemplo n.º 16
0
        public void SetSite()
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            // Create the package
            IVsPackage package = new AnkhSvnPackage() as IVsPackage;

            Assert.IsNotNull(package, "The object does not implement IVsPackage");

            var statusCache = new Mock <ISvnStatusCache>();
            var regEditors  = new Mock <SVsRegisterEditors>().As <IVsRegisterEditors>();

            var    vsShell = new Mock <SVsShell>().As <IVsShell>();
            object r       = @"SOFTWARE\Microsoft\VisualStudio\8.0";

            vsShell.Setup(x => x.GetProperty((int)__VSSPROPID.VSSPROPID_VirtualRegistryRoot, out r)).Returns(VSErr.S_OK);

            var vsTextMgr = new Mock <SVsTextManager>().As <IVsTextManager>();

            var monitorSelection = new Mock <IVsMonitorSelection>();

            var olMgr = new Mock <SOleComponentManager>().As <IOleComponentManager>();

            var outputWindow = new Mock <SVsOutputWindow>().As <IVsOutputWindow>();

            using (ServiceProviderHelper.AddService(typeof(SVsOutputWindow), outputWindow.Object))
                using (ServiceProviderHelper.AddService(typeof(SOleComponentManager), olMgr.Object))
                    using (ServiceProviderHelper.AddService(typeof(IVsMonitorSelection), monitorSelection.Object))
                        using (ServiceProviderHelper.AddService(typeof(SVsTextManager), vsTextMgr.Object))
                            using (ServiceProviderHelper.AddService(typeof(SVsShell), vsShell.Object))
                                using (ServiceProviderHelper.AddService(typeof(SVsRegisterEditors), regEditors.Object))
                                    using (ServiceProviderHelper.AddService(typeof(ISvnStatusCache), statusCache.Object))
                                        using (ServiceProviderHelper.SetSite(package))
                                        {
                                            // Unsite the package
                                            Assert.AreEqual(0, package.SetSite(null), "SetSite(null) did not return S_OK");
                                        }
        }