public void WhenDeletingBrand_RepositoryIsCalled(string selection) { // Arrange CarLogic logic = new CarLogic(); logic.SetRepositoryInterface(this.mockedRepository.Object); // Act logic.DeleteBrand(selection); // Assert (Verify) this.mockedRepository.Verify(m => m.DeleteBrandRepo(It.IsAny <car_brands>()), Times.AtLeastOnce); }
public void WhenDeletingBrandWithInvalidId_ExceptionIsThrown(string selection) { // Arrange CarLogic logic = new CarLogic(); logic.SetRepositoryInterface(this.mockedRepository.Object); // Act, Assert Assert.Throws(typeof(InvalidParameterException), () => logic.DeleteBrand(selection)); this.mockedRepository.Verify( m => m.DeleteBrandRepo(It.IsAny <car_brands>()), Times.Never); }