public void ViewInWindowsCommand() { ISelectionContext selC = SelectionContextMock.EmptyContext(); using (ServiceProviderHelper.AddService(typeof(ISelectionContext), selC)) { Assert.That(CommandTester.TestExecution(AnkhCommand.ViewInWindows), Is.False); } }
public void RemoveWorkingCopyRoot() { ISelectionContext selC = SelectionContextMock.EmptyContext(); using (ServiceProviderHelper.AddService(typeof(ISelectionContext), selC)) { Assert.That(CommandTester.TestExecution(AnkhCommand.RemoveWorkingCopyExplorerRoot), Is.False); } }
public void UpdateItemCommand() { ISelectionContext selC = SelectionContextMock.EmptyContext(); using (ServiceProviderHelper.AddService(typeof(ISelectionContext), selC)) { Assert.That(CommandTester.TestExecution(AnkhCommand.UpdateItemSpecific), Is.False); } }
public void MakeDirectoryCommand() { ISelectionContext selC = SelectionContextMock.EmptyContext(); using (ServiceProviderHelper.AddService(typeof(ISelectionContext), selC)) { Assert.That(CommandTester.TestExecution(AnkhCommand.NewFolder), Is.False); } }
public void CopyReposExplorerUrl() { ISelectionContext selC = SelectionContextMock.EmptyContext(); using (ServiceProviderHelper.AddService(typeof(ISelectionContext), selC)) { Assert.That(CommandTester.TestExecution(AnkhCommand.CopyReposExplorerUrl), Is.False); } }
public void DiffLocalItem() { ISelectionContext selC = SelectionContextMock.EmptyContext(); using (ServiceProviderHelper.AddService(typeof(ISelectionContext), selC)) { Assert.That(CommandTester.TestExecution(AnkhCommand.DiffLocalItem), Is.False); } }
public void AddWorkingCopyExplorerRootCommandWithPath() { ISelectionContext selC = SelectionContextMock.EmptyContext(); using (ServiceProviderHelper.AddService(typeof(ISelectionContext), selC)) { Assert.IsTrue(CommandTester.TestExecution(AnkhCommand.WorkingCopyBrowse, Path.GetTempPath())); } }
public void AddItem() { ISelectionContext selC = SelectionContextMock.EmptyContext(); using (ServiceProviderHelper.AddService(typeof(ISelectionContext), selC)) { Assert.IsFalse(CommandTester.TestExecution(AnkhCommand.AddItem), "Add disabled with empty selection"); } }
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"); } }
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"); } }
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"); } }
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"); } }
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"); } }
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); } }
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); }
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"); } }