public async Task UpdateAsync_Should_Update_Existing_Entity_From_DatabaseAsync() { //Arrange var updateTodoListModel = Builder <UpdateTodoListModel> .CreateNew().Build(); var todoListId = Guid.NewGuid(); var todoList = Builder <TodoList> .CreateNew() .With(tl => tl.CreatedBy = new Guid().ToString()) .With(tl => tl.Id = todoListId) .Build(); TodoListRepository.GetFirstAsync(Arg.Any <Expression <Func <TodoList, bool> > >()).Returns(todoList); TodoListRepository.UpdateAsync(Arg.Any <TodoList>()).Returns(todoList); //Act var result = await _sut.UpdateAsync(todoListId, updateTodoListModel); //Assert result.Id.Should().Be(todoListId); await TodoListRepository.Received().GetFirstAsync(Arg.Any <Expression <Func <TodoList, bool> > >()); ClaimService.Received().GetUserId(); await TodoListRepository.Received().UpdateAsync(Arg.Any <TodoList>()); }