public void WebSeedsAreIntroducedCorrectly() { var cT = new CommandTester() .UsingAssemblyFrom<AssemblyWithSingleDownload>() .Test(new AddWebSeedCommand("http://localhost:80")); cT.Seed.WebSeeds.ShouldHaveCount(1); }
public void VersioningIsAddedCorrectly() { var cT = new CommandTester() .UsingAssemblyFrom<AssemblyWithSingleDownload>() .Test(new VersionFromAssemblyCommand()); cT.Seed.Version.ShouldBeEqualTo("1.0.0.0"); }
public void DataFromAssemblyCommandCorrectlyProvidesInformation() { var cT = new CommandTester() .UsingAssemblyFrom<AttributesOnly>() .Test<DataFromAssemblyCommand>(); cT.Seed.TorrentName.ShouldBeEqualTo("acme stuff.torrent"); cT.Seed.Publisher.ShouldBeEqualTo("acme inc."); }
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 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"); } }
private static (string Name, string Value)? ExtractParameter(string source) { var match = CommandTester.Match(source); if (match.Groups.Count < 3) { return(null); } return(match.Groups[1].Value, match.Groups[2].Value); }
public void CanNotExecuteTwice() { CommandTester tester = new CommandTester(() => true, () => { }, true); tester.Execute(); InvalidOperationException exception = Assert.Throws <InvalidOperationException>(() => tester.Execute()); Assert.IsTrue(exception.Message.Contains(tester.Name)); }
public void ShowWorkingCopyExplorer() { //IAnkhPackage package = mocks.CreateMock<IAnkhPackage>(); //using (mocks.Record()) //{ // package.ShowToolWindow(AnkhToolWindow.WorkingCopyExplorer); // LastCall.Repeat.Once(); //} //using (mocks.Playback()) //{ CommandTester.TestExecution(AnkhCommand.ShowWorkingCopyExplorer); //} }
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 Execute(bool executeActionResult) { bool executeAction = false; bool rollbackAction = false; CommandTester tester = new CommandTester(() => { { executeAction = true; return(executeActionResult); } }, () => { rollbackAction = true; }, true); Assert.AreEqual(executeActionResult, tester.Execute()); Assert.IsTrue(executeAction); Assert.IsFalse(rollbackAction); }
public void AddWorkingCopyExplorerRootCommand() { CommandTester.TestExecution(AnkhCommand.WorkingCopyBrowse); }
public void AddRepositoryRoot() { Assert.IsTrue(CommandTester.TestExecution(AnkhCommand.RepositoryBrowse), "Add repository root always enabled"); }