Пример #1
0
        public async Task UpdateAsync_Should_Throw_Exception_If_List_Does_Not_Exist_Anymore()
        {
            // Arrange
            var updateTodoItem = Builder <UpdateTodoItemModel> .CreateNew().Build();

            _todoListRepository.GetFirstAsync(Arg.Any <Expression <Func <TodoList, bool> > >()).ReturnsNull();

            // Act
            Func <Task> callCreateAsync = async() => await _sut.UpdateAsync(Guid.NewGuid(), updateTodoItem);

            // Assert
            callCreateAsync.Should().Throw <NotFoundException>().WithMessage("List does not exist anymore");
            await _todoListRepository.Received().GetFirstAsync(Arg.Any <Expression <Func <TodoList, bool> > >());
        }