public void When_add_user_and_deleteById_then_return_null() { //Setup var user = new User() { Id = "hhhhhh" }; repoMock .Setup(r => r.Get(It.IsAny <string>())) .Returns(user); repoMock .Setup(r => r.Delete(It.IsAny <User>())); //Act userList.DeleteById("hhhhhh"); //Assert repoMock.Verify(r => r.Delete(It.IsAny <User>()), Times.Once); }
public IActionResult Delete(string id) { userList.DeleteById(id.Replace('*', '\\')); return(RedirectToAction("Index")); }