Exemplo n.º 1
0
        public void IgnoresNullsOnError()
        {
            var jiraApi = new Mock <IJiraApi>();

            jiraApi.Setup(x => x.FromId("NOT-3")).ReturnsAsync(null);

            var jiraBugProcessor = new JiraBugProcessor(CommandParser.For(""), jiraApi.Object);
            var result           = jiraBugProcessor.ProcessMessage(new Message("a-channel", "a-user", "how about this bug: NOT-3"));

            CollectionAssert.IsEmpty(result.Responses);
        }
Exemplo n.º 2
0
        public void DoesntMentionTheSameBugTwice()
        {
            var jiraApi = new Mock <IJiraApi>();
            var jiraBug = CreateJiraBug();

            jiraApi.Setup(x => x.FromId("SC-1234")).ReturnsAsync(jiraBug);

            var jiraBugProcessor = new JiraBugProcessor(CommandParser.For(""), jiraApi.Object);
            var result           = jiraBugProcessor.ProcessMessage(new Message("a-channel", "a-user", "SC-1234 and SC-1234"));

            Assert.AreEqual(1, result.Responses.Count());
        }
Exemplo n.º 3
0
        public void CanFetchMultipleBugsInMessages()
        {
            var jiraApi = new Mock <IJiraApi>();
            var jiraBug = CreateJiraBug();

            jiraApi.Setup(x => x.FromId("SDC-1604")).ReturnsAsync(jiraBug);
            jiraApi.Setup(x => x.FromId("SC-1234")).ReturnsAsync(jiraBug);

            var jiraBugProcessor = new JiraBugProcessor(CommandParser.For(""), jiraApi.Object);
            var result           = jiraBugProcessor.ProcessMessage(new Message("a-channel", "a-user", "SC-1234 and SDC-1604 too"));

            Assert.AreEqual(2, result.Responses.Count());
        }
Exemplo n.º 4
0
        public void UsesJiraApiToPrintBugReferenceDetails()
        {
            var jiraApi = new Mock <IJiraApi>();
            var jiraBug = CreateJiraBug();

            jiraApi.Setup(x => x.FromId("SDC-1604")).ReturnsAsync(jiraBug);

            var jiraBugProcessor = new JiraBugProcessor(CommandParser.For(""), jiraApi.Object);
            var result           = jiraBugProcessor.ProcessMessage(new Message("a-channel", "a-user", "how about this bug: SDC-1604"));
            var response         = result.Responses.Single();

            Assert.AreEqual("<https://jira.red-gate.com/browse/SDC-1604|SDC-1604> | Bug | Projects occasionally blow up when loaded against dbs with schema differences | Open | 1 comment", response.Message);
        }