public static async Task ExecuteAsync(
     [HttpTrigger("put", Route = "todo/{todoListId}")] HttpRequest httpRequest,
     [Request] UpdateTodoListRequestDto requestDto,
     [Document] TodoListDocument todoListDocument,
     [Authorization] UserDocument userDocument,
     [Validation(ValidatorType = typeof(UpdateTodoListValidator),
                 ThrowIfInvalid = true)] ValidationResult validationResult,
     [Service] ITodoService service,
     CancellationToken cancellationToken)
 => await service.UpdateTodoListAsync(requestDto, todoListDocument, userDocument, cancellationToken);
Esempio n. 2
0
        public async Task UpdateTodoListAsync()
        {
            var requestDto = new UpdateTodoListRequestDto
            {
                TodoListId  = Guid.NewGuid(),
                Title       = TodoServiceTest.GetRandomToken(),
                Description = TodoServiceTest.GetRandomToken(),
            };
            var todoListDocument = new TodoListDocument();
            var userDocument     = new UserDocument();

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

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

            _documentClientMock.Verify();
        }
 /// <summary>Initializes a new instance of the <see cref="AzureFunctionsCustomBindingSample.Api.Validators."/> class.</summary>
 /// <param name="requestDto">An object that represents data to update a TODO list.</param>
 public UpdateTodoListValidator(UpdateTodoListRequestDto requestDto)
 => _requestDto = requestDto ?? throw new ArgumentNullException(nameof(requestDto));