public async void GettingCustomerStatusShouldReturnCustomerStatusRequestObject() { var browserResponse = await _browser.Post("/customer/status", with => { var customerStatusRequest = new CustomerStatusRequest() { TeamId = 24, Date = new DateTime(2016, 1, 19), Sprint = new Sprint { Start = new DateTime(2016, 1, 12), End = new DateTime(2016, 1, 26) }, ProjectKeys = new List <string>() { "KEY" }, HoursReserved = 30 }; with.JsonBody(customerStatusRequest); with.Header("Accept", "application/json"); with.HttpRequest(); }); var body = browserResponse.Body.DeserializeJson <CustomerStatusResponse>(); body.HoursReserved.Should().Be(30); body.HoursExpected.Should().Be(15); body.LoggedHoursValue.Should().Be(LoggedHoursValue.Positive); body.Percentage.Should().Be(50); body.TotalHours.Should().Be(15); }
public CustomerStatusResponse GetCustomerStatus(CustomerStatusRequest customerStatusRequest) { var sprint = new Sprint(customerStatusRequest.Sprint.Start, customerStatusRequest.Sprint.End); var worklogs = new List <Worklog>(); //per project foreach (var projectKey in customerStatusRequest.ProjectKeys) { //get all worklogs for this project between sprint start and end worklogs.AddRange( _jiraClient .WithBaseUrl(_config.RestApi) .ForResource(_config.WorklogResource) .UsingCredentials(_credentials) .WithQueryParam("projectKey", projectKey) .WithQueryParam("teamId", customerStatusRequest.TeamId.ToString()) .WithQueryParam("dateFrom", sprint.Start.ToString("yyyy-MM-dd")) .WithQueryParam("dateTo", customerStatusRequest.Date.Value.ToString("yyyy-MM-dd")) .ExecuteAsync <List <Worklog> >() .Result); } //calculate hour status return(CustomerStatusFromWorklogs(sprint, customerStatusRequest.Date.Value, worklogs, customerStatusRequest.HoursReserved.Value)); }
public async void GettingCustomerStatusShouldReturnStatusCodeOk() { var browserResponse = await _browser.Post("/customer/status", with => { var customerStatusRequest = new CustomerStatusRequest() { TeamId = 24, Date = new DateTime(2016, 1, 15), Sprint = new Sprint { Start = new DateTime(2016, 1, 12), End = new DateTime(2016, 1, 26) }, ProjectKeys = new List <string>() { "KEY" }, HoursReserved = 20 }; with.JsonBody(customerStatusRequest); with.Header("Accept", "application/json"); with.HttpRequest(); }); browserResponse.StatusCode.Should().Be(HttpStatusCode.OK); }