Esempio n. 1
0
        public void CreatePostWorklogRequest_RemoveLeadingAndTrailingSpacesFromIssueKey()
        {
            string   key     = "   FOO-42   ";
            var      started = new DateTimeOffset(2016, 07, 26, 1, 44, 15, TimeSpan.Zero);
            TimeSpan time    = new TimeSpan(1, 2, 0);
            string   comment = "Sorry for the inconvenience...";

            StopWatch.EstimateUpdateMethods adjusmentMethod = EstimateUpdateMethods.Auto;
            string adjustmentValue = "";
            var    request         = jiraApiRequestFactory.CreatePostWorklogRequest(key, started, time, comment, adjusmentMethod, adjustmentValue);

            requestFactoryMock.Verify(m => m.Create(String.Format("/rest/api/2/issue/{0}/worklog", key.Trim()), Method.POST));
        }
Esempio n. 2
0
        public void CreatePostWorklogRequest_CreatesValidRequest()
        {
            string   key     = "FOO-42";
            var      started = new DateTimeOffset(2016, 07, 26, 1, 44, 15, TimeSpan.Zero);
            TimeSpan time    = new TimeSpan(1, 2, 0);
            string   comment = "Sorry for the inconvenience...";

            StopWatch.EstimateUpdateMethods adjusmentMethod = EstimateUpdateMethods.Auto;
            string adjustmentValue = "";
            var    request         = jiraApiRequestFactory.CreatePostWorklogRequest(key, started, time, comment, adjusmentMethod, adjustmentValue);

            requestFactoryMock.Verify(m => m.Create(String.Format("/rest/api/2/issue/{0}/worklog", key), Method.POST));

            requestMock.VerifySet(m => m.RequestFormat = DataFormat.Json);

            requestMock.Verify(m => m.AddBody(It.Is <object>(o =>
                                                             o.GetHashCode() == (new {
                timeSpent = JiraTimeHelpers.TimeSpanToJiraTime(time),
                started = "2016-07-26T01:44:15.000+0000",
                comment = comment
            }).GetHashCode()
                                                             )));
        }