public void GetByValidId_2() { Setup(); //Arrange var id = 1; var list = TodoListMock.GetList(); var item = new TodoItem() { Title = "Todo 1", Description = "Desc 1", IsCompleted = false, Id = 1, }; _repositoryMock.Setup(item => item.GetById(It.IsAny <int>())).ReturnsAsync(item); //Act var result = _todoItemService.Get(id).Result; //Assert _repositoryMock.Verify(item => item.GetById(id), Times.Once); Assert.NotNull(result); Assert.Equal(item, result); }