public async Task UpdateTimeEntryAsync_NullStart_ShouldThrowArgumentException() { var updateTimeEntryRequest = new UpdateTimeEntryRequest() { Start = null, }; Func <Task> create = () => _client.UpdateTimeEntryAsync(_workspaceId, "", updateTimeEntryRequest); await create.Should().ThrowAsync <ArgumentException>() .WithMessage($"Argument cannot be null. (Parameter '{nameof(TimeEntryRequest.Start)}')"); }
public async Task UpdateTimeEntryAsync_NullBillable_ShouldThrowArgumentException() { var updateTimeEntryRequest = new UpdateTimeEntryRequest() { Start = DateTimeOffset.UtcNow, Billable = null }; Func <Task> create = () => _client.UpdateTimeEntryAsync(_workspaceId, "", updateTimeEntryRequest); await create.Should().ThrowAsync <ArgumentException>() .WithMessage($"Value cannot be null. (Parameter '{nameof(TimeEntryRequest.Billable)}')"); }
/// <summary> /// Update time entry with id. /// </summary> public Task <IRestResponse <TimeEntryDtoImpl> > UpdateTimeEntryAsync(string workspaceId, string timeEntryId, UpdateTimeEntryRequest updateTimeEntryRequest) { if (updateTimeEntryRequest == null) { throw new ArgumentNullException(nameof(updateTimeEntryRequest)); } Require.Argument(nameof(updateTimeEntryRequest.Start), updateTimeEntryRequest.Start); Require.Argument(nameof(updateTimeEntryRequest.Billable), updateTimeEntryRequest.Billable); var request = new RestRequest($"workspaces/{workspaceId}/time-entries/{timeEntryId}", Method.PUT); request.AddJsonBody(updateTimeEntryRequest); return(_client.ExecuteTaskAsync <TimeEntryDtoImpl>(request)); }
public async Task UpdateTimeEntryAsync_ShouldUpdateAndTimeEntryDtoImpl() { var now = DateTimeOffset.UtcNow; var timeEntryRequest = new TimeEntryRequest { Start = now, }; var createResult = await _client.CreateTimeEntryAsync(_workspaceId, timeEntryRequest); createResult.IsSuccessful.Should().BeTrue(); createResult.Data.Should().NotBeNull(); var timeEntryId = createResult.Data.Id; var updateTimeEntryRequest = new UpdateTimeEntryRequest { Start = now.AddSeconds(-1), Billable = true, }; var updateResult = await _client.UpdateTimeEntryAsync(_workspaceId, timeEntryId, updateTimeEntryRequest); updateResult.IsSuccessful.Should().BeTrue(); }