Example #1
0
 public static async Task <CreateTodoListTaskResponseDto> ExecuteAsync(
     [HttpTrigger("post", Route = "todo/{todoListId}/task")] HttpRequest httpRequest,
     [Request] CreateTodoListTaskRequestDto requestDto,
     [Document] TodoListDocument todoListDocument,
     [Authorization] UserDocument userDocument,
     [Validation(ValidatorType = typeof(CreateTodoListTaskValidator),
                 ThrowIfInvalid = true)] ValidationResult validationResult,
     [Service] ITodoService service,
     CancellationToken cancellationToken)
 => await service.CreateTodoListTaskAsync(requestDto, todoListDocument, userDocument, cancellationToken);
Example #2
0
        public async Task CreateTodoListTaskAsync()
        {
            var requestDto = new CreateTodoListTaskRequestDto
            {
                TodoListId  = Guid.NewGuid(),
                Title       = TodoServiceTest.GetRandomToken(),
                Description = TodoServiceTest.GetRandomToken(),
                Deadline    = DateTime.UtcNow.AddDays(20),
            };
            var todoListDocument = new TodoListDocument
            {
                Id = requestDto.TodoListId,
            };
            var userDocument = new UserDocument();

            _documentClientMock.Setup(client => client.UpdateAsync(
                                          It.IsAny <TodoListDocument>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new TodoListDocument());

            await _todoService.CreateTodoListTaskAsync(requestDto, todoListDocument, userDocument, CancellationToken.None);

            _documentClientMock.Verify();
        }