Exemplo n.º 1
0
        public async Task UpdateTodoListTaskAsync()
        {
            var requestDto = new UpdateTodoListTaskRequestDto
            {
                TodoListId     = Guid.NewGuid(),
                TodoListTaskId = Guid.NewGuid(),
                Title          = TodoServiceTest.GetRandomToken(),
                Description    = TodoServiceTest.GetRandomToken(),
                Deadline       = DateTime.UtcNow.AddDays(20),
            };
            var todoListDocument = new TodoListDocument
            {
                Id    = requestDto.TodoListId,
                Tasks = new[]
                {
                    new TodoListTaskDocument
                    {
                        TaskId = requestDto.TodoListTaskId,
                    },
                },
            };
            var userDocument = new UserDocument();

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

            _documentClientMock.Verify();
        }
Exemplo n.º 2
0
 public static async Task ExecuteAsync(
     [HttpTrigger("put", Route = "todo/{todoListId}/task/{todoListTaskId}")] HttpRequest httpRequest,
     [Request] UpdateTodoListTaskRequestDto requestDto,
     [Document] TodoListDocument todoListDocument,
     [Authorization] UserDocument userDocument,
     [Validation(ValidatorType = typeof(UpdateTodoListTaskValidator),
                 ThrowIfInvalid = true)] ValidationResult validationResult,
     [Service] ITodoService service,
     CancellationToken cancellationToken)
 => await service.UpdateTodoListTaskAsync(requestDto, todoListDocument, userDocument, cancellationToken);
 /// <summary>Initializes a new instance of the <see cref="AzureFunctionsCustomBindingSample.Api.Validators."/> class.</summary>
 /// <param name="requestDto">An object that represents data to a task of a TODO list.</param>
 public UpdateTodoListTaskValidator(UpdateTodoListTaskRequestDto requestDto)
 => _requestDto = requestDto ?? throw new ArgumentNullException(nameof(requestDto));