public void Delete_ReturnsHttpNotFound_WhenEmptyIdSupplied() { // Arrange var controller = new PhoneBookController(_mockRepo.Object); // Act var result = controller.Delete(Guid.Empty); // Assert Assert.IsType <NotFoundResult>(result); }
public void Delete_ReturnsHttpOk_WhenContentIsDeleted() { // Arrange Guid id = Guid.NewGuid(); PhoneBook mockPhoneBookEntry = new PhoneBook(); _mockRepo.Setup(repo => repo.Get(id)) .ReturnsAsync(mockPhoneBookEntry); var controller = new PhoneBookController(_mockRepo.Object); // Act var result = controller.Delete(id); // Assert _mockRepo.Verify(repo => repo.Delete(id), Times.Once); Assert.IsType <OkResult>(result); }
public void Delete_ReturnsHttpNotFound_WhenNoContentLoaded() { // Arrange Guid id = new Guid(); PhoneBook mockPhoneBookEntry = null; _mockRepo.Setup(repo => repo.Get(id)) .ReturnsAsync(mockPhoneBookEntry); var controller = new PhoneBookController(_mockRepo.Object); // Act var result = controller.Delete(Guid.Empty); // Assert Assert.IsType <NotFoundResult>(result); }