Exemple #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();
        }
Exemple #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();
        }
Exemple #3
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();
        }
Exemple #4
0
        public async Task CreateTodoListAsync()
        {
            var requestDto = new CreateTodoListRequestDto
            {
                Title       = TodoServiceTest.GetRandomToken(),
                Description = TodoServiceTest.GetRandomToken(),
            };
            var userDocument = new UserDocument();

            _documentClientMock.Setup(client => client.InsertAsync(
                                          It.IsAny <TodoListDocument>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new TodoListDocument
            {
                Id = Guid.NewGuid(),
            });

            var responseDto = await _todoService.CreateTodoListAsync(
                requestDto, userDocument, CancellationToken.None);

            Assert.IsNotNull(responseDto);
            Assert.IsFalse(responseDto.TodoListId == default, "TodoListId == default");

            _documentClientMock.Verify();
        }