Ejemplo n.º 1
0
 public void WebSeedsAreIntroducedCorrectly()
 {
     var cT = new CommandTester()
       .UsingAssemblyFrom<AssemblyWithSingleDownload>()
       .Test(new AddWebSeedCommand("http://localhost:80"));
     cT.Seed.WebSeeds.ShouldHaveCount(1);
 }
Ejemplo n.º 2
0
 public void VersioningIsAddedCorrectly()
 {
     var cT = new CommandTester()
       .UsingAssemblyFrom<AssemblyWithSingleDownload>()
       .Test(new VersionFromAssemblyCommand());
     cT.Seed.Version.ShouldBeEqualTo("1.0.0.0");
 }
Ejemplo n.º 3
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.");
 }
Ejemplo n.º 4
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");
            }
        }
Ejemplo n.º 5
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");
            }
        }
Ejemplo n.º 6
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");
            }
        }
Ejemplo n.º 7
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");
            }
        }
Ejemplo n.º 8
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");
            }
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
        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));
        }
Ejemplo n.º 11
0
        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);
            //}
        }
Ejemplo n.º 12
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);
                }
        }
Ejemplo n.º 13
0
        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);
        }
Ejemplo n.º 14
0
 public void AddWorkingCopyExplorerRootCommand()
 {
     CommandTester.TestExecution(AnkhCommand.WorkingCopyBrowse);
 }
Ejemplo n.º 15
0
 public void AddRepositoryRoot()
 {
     Assert.IsTrue(CommandTester.TestExecution(AnkhCommand.RepositoryBrowse), "Add repository root always enabled");
 }