Inheritance: JiraCommandBase
Exemplo n.º 1
0
        public void TestHelpMessageContainsAliases()
        {
            Mock<IJiraProxy> mockedJiraSoapProxy = MockedJiraSoapProxy();
            var linkCommand = new LinkIssueCommand(
                                        mockedJiraSoapProxy.Object,
                                        "Testing issue linking.");

            var linkConfiguration = JiraConfig.Instance.CommandConfigurationFor("link").Deserialize<LinkConfiguration>();

            foreach (var alias in linkConfiguration.Aliases)
            {
                StringAssert.Contains(alias.Original, linkCommand.Help);
            }
        }
Exemplo n.º 2
0
        public void TestLinkAliases()
        {
            Mock<IJiraProxy> mockedJiraSoapProxy = MockedJiraSoapProxy();
            mockedJiraSoapProxy.Setup(jiraProxy => jiraProxy.CreateLink(SourceIssue, ExpectedLinkDescription, TargetIssue, false));

            var linkCommand = new LinkIssueCommand(
                                        mockedJiraSoapProxy.Object,
                                        "Testing issue linking.");

            Mock<IContext> mockedContext = ContextMockFor("foo", SourceIssue, "associate", TargetIssue);
            var result = linkCommand.Process(mockedContext.Object);

            Assert.AreEqual(string.Format("[Link] Link created successfully: {0} {1} {2}", SourceIssue, "associate", TargetIssue), result.HumanReadable);
            Assert.AreEqual(SourceIssue + ", " + TargetIssue, result.PipeValue);

            mockedJiraSoapProxy.VerifyAll();
        }
Exemplo n.º 3
0
        public void TestSuccessfulLink()
        {
            Mock<IJiraProxy> mockedJiraSoapProxy = MockedJiraSoapProxy();
            mockedJiraSoapProxy.Setup(jiraProxy => jiraProxy.CreateLink(SourceIssue, "Tested With", TargetIssue, false));

            var linkCommand = new LinkIssueCommand(
                                        mockedJiraSoapProxy.Object,
                                        "Testing issue linking.");

            Mock<IContext> mockedContext = ContextMockFor("foo", SourceIssue, "\"Tested With\"", TargetIssue);
            var result = linkCommand.Process(mockedContext.Object);

            Assert.AreEqual("[Link] Link created successfully: TIL-001 Tested With TIL-002", result.HumanReadable);
            Assert.AreEqual(SourceIssue + ", " + TargetIssue, result.PipeValue);

            mockedJiraSoapProxy.VerifyAll();
        }
Exemplo n.º 4
0
        public void TestSourceIssueDoNotExists()
        {
            Mock<IJiraProxy> mockedJiraSoapProxy = MockedJiraSoapProxy();
            const string NonExistingIssueKey = "TIL-001";
            mockedJiraSoapProxy.Setup(jiraProxy => jiraProxy.CreateLink(NonExistingIssueKey, "test-exception", "TIL-002", false)).Throws(new JiraProxyException("Exception Thrown", new Exception()));

            var linkCommand = new LinkIssueCommand(
                                        mockedJiraSoapProxy.Object,
                                        "Testing issue linking.");

            Mock<IContext> mockedContext = ContextMockFor("foo", NonExistingIssueKey, "test-exception", "TIL-002");
            var actualResult = linkCommand.Process(mockedContext.Object);

            Assert.IsTrue(actualResult.HumanReadable.Contains("Exception Thrown"));

            mockedJiraSoapProxy.VerifyAll();
        }