public ActionResult DeleteById(Guid id) { //Instantiate a person type object and assign the event to search by id Person person = personRepository.ReadById(id); //Delete the person in the database personRepository.Delete(person); return(RedirectToAction("List")); }
public void Delete_CallsContextDelete_WhenCalled( [NotNull, Frozen] IPersonsContext context, [NotNull] PersonsRepository sut) { // Arrange // Act sut.Delete(-1); // Assert context.Received().Delete(-1); }
public void Delete_ReturnsPerson_WhenCalled( [NotNull] IPerson person, [NotNull, Frozen] IPersonsContext context, [NotNull] PersonsRepository sut) { // Arrange context.Delete(Arg.Any <int>()).Returns(person); // Act IPerson actual = sut.Delete(-1); // Assert Assert.Equal(person, actual); }
public bool Delete(string id) { return(ipersonsRepository.Delete(id)); }
// DELETE api/values/5 public void Delete(int id) { _personsRepositoy.Delete(id); }