/// <summary> /// Adds a worklog to this issue. /// </summary> /// <param name="worklog">The worklog instance to add</param> /// <param name="worklogStrategy">How to handle the remaining estimate, defaults to AutoAdjustRemainingEstimate</param> /// <param name="newEstimate">New estimate (only used if worklogStrategy set to NewRemainingEstimate)</param> /// <returns>Worklog as constructed by server</returns> public Worklog AddWorklog(Worklog worklog, WorklogStrategy worklogStrategy = WorklogStrategy.AutoAdjustRemainingEstimate, string newEstimate = null) { if (String.IsNullOrEmpty(_originalIssue.key)) { throw new InvalidOperationException("Unable to add worklog to issue, issue has not been saved to server."); } RemoteWorklog remoteWorklog = worklog.ToRemote(); _jira.WithToken(token => { switch (worklogStrategy) { case WorklogStrategy.RetainRemainingEstimate: remoteWorklog = _jira.RemoteService.AddWorklogAndRetainRemainingEstimate(token, _originalIssue.key, remoteWorklog); break; case WorklogStrategy.NewRemainingEstimate: remoteWorklog = _jira.RemoteService.AddWorklogWithNewRemainingEstimate(token, _originalIssue.key, remoteWorklog, newEstimate); break; default: remoteWorklog = _jira.RemoteService.AddWorklogAndAutoAdjustRemainingEstimate(token, _originalIssue.key, remoteWorklog); break; } }); return(new Worklog(remoteWorklog)); }
public RemoteWorklog AddWorklog(string token, string key, RemoteWorklog worklog, string queryString = null) { var resource = String.Format("rest/api/2/issue/{0}/worklog?{1}", key, queryString); var response = this.ExecuteRequest(Method.POST, resource, worklog); return(this.GetWorkLogs(token, key).First(w => w.id == (string)response["id"])); }
internal void ProcessWorklog(JiraIssue issue, string timeSpent, TimeEstimateRecalcualationMethod method, string newTimeEstimate) { var remoteWorklog = new RemoteWorklog(); remoteWorklog.comment = "Time logged"; remoteWorklog.timeSpent = timeSpent; remoteWorklog.startDate = DateTime.Now; switch (method) { case TimeEstimateRecalcualationMethod.AdjustAutomatically: _service.addWorklogAndAutoAdjustRemainingEstimate(_token, issue.DisplayId, remoteWorklog); break; case TimeEstimateRecalcualationMethod.DoNotChange: _service.addWorklogAndRetainRemainingEstimate(_token, issue.DisplayId, remoteWorklog); break; case TimeEstimateRecalcualationMethod.SetToNewValue: _service.addWorklogWithNewRemainingEstimate(_token, issue.DisplayId, remoteWorklog, newTimeEstimate); break; default: throw new ArgumentOutOfRangeException("ProcessWorklog"); } }
public void IfNewRemainingEstimate_ShouldAddWorkLog() { var jira = TestableJira.Create(); var remoteWorkLog = new RemoteWorklog() { id = "12345" }; jira.SoapService.Setup(s => s.AddWorklogWithNewRemainingEstimate( It.IsAny <string>(), It.IsAny <string>(), It.IsAny <RemoteWorklog>(), It.IsAny <string>())).Returns(remoteWorkLog); var issue = (new RemoteIssue() { key = "key" }).ToLocal(jira); //act var result = issue.AddWorklog("1d", WorklogStrategy.NewRemainingEstimate, "5d"); //assert Assert.Equal("12345", result.Id); jira.SoapService.Verify(j => j.AddWorklogWithNewRemainingEstimate( "token", "key", It.Is <RemoteWorklog>(l => l.timeSpent == "1d"), "5d")); }
public void addWorklogWithNewRemainingEstimateFixed(string in0, string in1, RemoteWorklog in2, string in3) { object[] results = this.Invoke("addWorklogWithNewRemainingEstimate", new object[] { in0, in1, in2, in3 }); //return ((RemoteWorklog)(results[0])); }
public void logWorkAndUpdateRemainingManually(string key, string timeSpent, DateTime startDate, string remainingEstimate, string comment) { #if PLVS_133_WORKAROUND ConstructorInfo constructor = getRemoteWorklogConstructor(key); object worklog = createWorklogObject(constructor, timeSpent, startDate, comment); service.addWorklogWithNewRemainingEstimate(Token, key, worklog, remainingEstimate); #else RemoteWorklog worklog = new RemoteWorklog { timeSpent = timeSpent, startDate = startDate }; service.addWorklogWithNewRemainingEstimate(Token, key, worklog, remainingEstimate); #endif }
public void logWorkAndLeaveRemainingUnchanged(string key, string timeSpent, DateTime startDate, string comment) { #if PLVS_133_WORKAROUND ConstructorInfo constructor = getRemoteWorklogConstructor(key); object worklog = createWorklogObject(constructor, timeSpent, startDate, comment); service.addWorklogAndRetainRemainingEstimate(Token, key, worklog); #else RemoteWorklog worklog = new RemoteWorklog { timeSpent = timeSpent, startDate = startDate }; service.addWorklogAndRetainRemainingEstimate(Token, key, worklog); #endif }
internal Worklog(RemoteWorklog remoteWorklog) { if (remoteWorklog != null) { this.Author = remoteWorklog.author; this.Comment = remoteWorklog.comment; this.StartDate = remoteWorklog.startDate; this.TimeSpent = remoteWorklog.timeSpent; _id = remoteWorklog.id; _created = remoteWorklog.created; _timeSpentInSeconds = remoteWorklog.timeSpentInSeconds; _updated = remoteWorklog.updated; } }
internal Worklog(RemoteWorklog remoteWorklog) { if (remoteWorklog != null) { this.Author = remoteWorklog.authorUser?.InternalIdentifier; this.AuthorUser = remoteWorklog.authorUser; this.Comment = remoteWorklog.comment; this.StartDate = remoteWorklog.startDate; this.TimeSpent = remoteWorklog.timeSpent; Id = remoteWorklog.id; CreateDate = remoteWorklog.created; TimeSpentInSeconds = remoteWorklog.timeSpentInSeconds; UpdateDate = remoteWorklog.updated; } }
public void ShouldGetWorklogsFromServer() { var jira = TestableJira.Create(); var logs = new RemoteWorklog[] { new RemoteWorklog() { id = "12345" } }; jira.SoapService.Setup(s => s.GetWorkLogs(It.IsAny <string>(), "111")).Returns(logs); var issue = (new RemoteIssue() { key = "111" }).ToLocal(jira); var result = issue.GetWorklogs(); Assert.Equal("12345", result.First().Id); }
/// <remarks/> public void updateWorklogWithNewRemainingEstimateAsync(string in0, RemoteWorklog in1, string in2) { this.updateWorklogWithNewRemainingEstimateAsync(in0, in1, in2, null); }
public void updateWorklogAndRetainRemainingEstimate(string in0, RemoteWorklog in1) { this.Invoke("updateWorklogAndRetainRemainingEstimate", new object[] { in0, in1}); }
/// <remarks/> public void addWorklogAndRetainRemainingEstimateAsync(string in0, string in1, RemoteWorklog in2) { this.addWorklogAndRetainRemainingEstimateAsync(in0, in1, in2, null); }
public void updateWorklogWithNewRemainingEstimate(string in0, RemoteWorklog in1, string in2) { this.Invoke("updateWorklogWithNewRemainingEstimate", new object[] { in0, in1, in2}); }
/// <remarks/> public void addWorklogAndAutoAdjustRemainingEstimateAsync(string in0, string in1, RemoteWorklog in2, object userState) { if ((this.addWorklogAndAutoAdjustRemainingEstimateOperationCompleted == null)) { this.addWorklogAndAutoAdjustRemainingEstimateOperationCompleted = new System.Threading.SendOrPostCallback(this.OnaddWorklogAndAutoAdjustRemainingEstimateOperationCompleted); } this.InvokeAsync("addWorklogAndAutoAdjustRemainingEstimate", new object[] { in0, in1, in2}, this.addWorklogAndAutoAdjustRemainingEstimateOperationCompleted, userState); }
public void addWorklogAndRetainRemainingEstimate(string in0, string in1, RemoteWorklog in2) { this.Invoke("addWorklogAndRetainRemainingEstimate", new object[] { in0, in1, in2}); }
public void addWorklogAndAutoAdjustRemainingEstimateFixed(string in0, string in1, RemoteWorklog in2) { object[] results = this.Invoke("addWorklogAndAutoAdjustRemainingEstimate", new object[] { in0, in1, in2 }); //return ((RemoteWorklog)(results[0])); }
public void UpdateWorklogAndRetainRemainingEstimate(string in0, RemoteWorklog in1) { _client.updateWorklogAndRetainRemainingEstimate(in0, in1); }
/// <remarks/> public void updateWorklogAndRetainRemainingEstimateAsync(string in0, RemoteWorklog in1) { this.updateWorklogAndRetainRemainingEstimateAsync(in0, in1, null); }
public void UpdateWorklogAndAutoAdjustRemainingEstimate(string in0, RemoteWorklog in1) { _client.updateWorklogAndAutoAdjustRemainingEstimate(in0, in1); }
public RemoteWorklog AddWorklogAndRetainRemainingEstimate(string token, string key, RemoteWorklog worklog) { return(AddWorklog(token, key, worklog, "adjustEstimate=leave")); }
public RemoteWorklog AddWorklogAndAutoAdjustRemainingEstimate(string token, string key, RemoteWorklog worklog) { return(AddWorklog(token, key, worklog)); }
public RemoteWorklog AddWorklogWithNewRemainingEstimate(string token, string key, RemoteWorklog worklog, string newRemainingEstimate) { return(_client.addWorklogWithNewRemainingEstimate(token, key, worklog, newRemainingEstimate)); }
public void UpdateWorklogWithNewRemainingEstimate(string in0, RemoteWorklog in1, string in2) { throw new NotImplementedException(); }
public void UpdateWorklogAndRetainRemainingEstimate(string in0, RemoteWorklog in1) { throw new NotImplementedException(); }
/// <remarks/> public void updateWorklogAndRetainRemainingEstimateAsync(string in0, RemoteWorklog in1, object userState) { if ((this.updateWorklogAndRetainRemainingEstimateOperationCompleted == null)) { this.updateWorklogAndRetainRemainingEstimateOperationCompleted = new System.Threading.SendOrPostCallback(this.OnupdateWorklogAndRetainRemainingEstimateOperationCompleted); } this.InvokeAsync("updateWorklogAndRetainRemainingEstimate", new object[] { in0, in1}, this.updateWorklogAndRetainRemainingEstimateOperationCompleted, userState); }
public RemoteWorklog AddWorklogAndRetainRemainingEstimate(string token, string key, RemoteWorklog worklog) { return(_client.addWorklogAndRetainRemainingEstimate(token, key, worklog)); }
public void addWorklogWithNewRemainingEstimate(string in0, string in1, RemoteWorklog in2, string in3) { this.Invoke("addWorklogWithNewRemainingEstimate", new object[] { in0, in1, in2, in3}); }
/// <remarks/> public void addWorklogWithNewRemainingEstimateAsync(string in0, string in1, RemoteWorklog in2, string in3) { this.addWorklogWithNewRemainingEstimateAsync(in0, in1, in2, in3, null); }
public RemoteWorklog AddWorklogWithNewRemainingEstimate(string token, string key, RemoteWorklog worklog, string newRemainingEstimate) { return(AddWorklog(token, key, worklog, "adjustEstimate=new&newEstimate=" + newRemainingEstimate)); }
public void UpdateWorklogWithNewRemainingEstimate(string in0, RemoteWorklog in1, string in2) { _client.updateWorklogWithNewRemainingEstimate(in0, in1, in2); }