public void DeleteShouldReturnTrueIfRepositoryThrowsNoExceptions() { // Arrange var mock = new Mock <IDeliveryPersonRepository>(); var mockId = Guid.NewGuid(); Repository = mock.Object; Service = new DeliveryPersonService(Repository); // Act var result = Service.Delete(mockId); // Assert Assert.IsTrue(result); }
public void DeleteShouldReturnFalseIfRepositoryThrowsExceptions() { // Arrange var mock = new Mock <IDeliveryPersonRepository>(); var mockId = Guid.NewGuid(); mock.Setup(_ => _.DeleteDeliveryPersonById(mockId)) .Throws <Exception>(); Repository = mock.Object; Service = new DeliveryPersonService(Repository); // Act var result = Service.Delete(mockId); // Assert Assert.IsFalse(result); }