Ejemplo n.º 1
0
        public async AsyncOperation ReturnAEmptyListOfTasks()
        {
            await _createTaskCommand.ExecuteAsync(new TaskDto
            {
                Name          = nameof(ReturnAListOfTasks),
                DescriptionId = 1
            });

            var result = await _sut.ExecuteAsync(x => false);

            result.Should().BeAssignableTo <List <Task> >()
            .And.BeEmpty();
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        public async Task TrackWorkTime()
        {
            await _createTaskCommand.ExecuteAsync(new TaskDto
            {
                Name = nameof(TrackWorkTime)
            });

            var tasks = await _getTaskQuery.ExecuteAsync(x => x.Name == nameof(TrackWorkTime));

            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 _sut.ExecuteAsync(tempTaskSchedule);
        }
Ejemplo n.º 5
0
        public async Task DeleteATask()
        {
            var tempTask = new TaskDto()
            {
                Name = nameof(DeleteATask)
            };

            await _createTaskCommand.ExecuteAsync(tempTask);

            var result = await _getTaskQuery.ExecuteAsync(x => x.Name == tempTask.Name);

            var task = result.First();

            tempTask = _mapper.Map <TaskDto>(task);

            await _sut.ExecuteAsync(tempTask);
        }
Ejemplo n.º 6
0
 public async Task GuardAgainstNull()
 {
     await Assert.ThrowsExceptionAsync <ArgumentNullException>(() => _sut.ExecuteAsync(null));
 }