private async Task <int> CreateTrackAsync() { await _createTaskCommand.ExecuteAsync(new TaskDto { Name = nameof(ReturnAListOfTasksSchedule) }); var tasks = await _getTaskQuery.ExecuteAsync(x => x.Name == nameof(ReturnAListOfTasksSchedule)); await _createScheduleCommand.ExecuteAsync(new ScheduleDto { ScheduleDate = DateTimeOffset.Now.Date }); var task = tasks.First(); var schedule = await _getCurrentScheduleQuery.ExecuteAsync(); await _trackWorkTimeCommand.ExecuteAsync(new TasksScheduleDto { Duration = TimeSpan.Zero, TaskId = task.Id, ScheduleId = schedule.Id }); return(schedule.Id); }
public async Task DeleteWorkTimeTracked() { await _createTaskCommand.ExecuteAsync(new TaskDto { Name = nameof(DeleteWorkTimeTracked) }); var tasks = await _getTasksQuery.ExecuteAsync(x => x.Name == nameof(DeleteWorkTimeTracked)); await _createScheduleCommand.ExecuteAsync(new ScheduleDto { ScheduleDate = DateTimeOffset.Now.Date }); var task = tasks.First(); var schedule = await _getCurrentScheduleQuery.ExecuteAsync(); var tempTaskSchedule = new TasksScheduleDto() { Duration = TimeSpan.Zero, TaskId = task.Id, ScheduleId = schedule.Id, }; await _trackWorkTimeCommand.ExecuteAsync(tempTaskSchedule); var result = await _getTasksScheduleQuery.ExecuteAsync(x => x.TaskId == task.Id && x.ScheduleId == schedule.Id); var trackedTime = result.First(); var timeToDelete = _mapper.Map <TasksScheduleDto>(trackedTime); await _sut.ExecuteAsync(timeToDelete); }
public async Task GuardAgainstNull() { await Assert.ThrowsExceptionAsync <ArgumentNullException>(() => _sut.ExecuteAsync(null)); }