public void add_Creates_one_Todo_And_Returns_1() { var todo = todosList.First(); //specify the mockContext return _mockContext.Setup(context => context.create(todo)).Returns(1); //instantiate the repository var todosRepository = new TodosRepository(_mockContext.Object, _logger); //Call the repository method var result = todosRepository.add(todo); //Assert the result var returnedValue = Assert.IsType <int>(result); Assert.Equal(1, returnedValue); }