public void Throw_WhenPassedParameterIsNull() { //Arrange var brands = new Mock <IEfGenericRepository <Brand> >(); var brandsService = new BrandsService(brands.Object); //Act & Assert Assert.Throws <ArgumentNullException>(() => brandsService.Update(null)); }
public void InvokeRepositoryMethodUpdateOnce_WhenPassedParameterIsValid() { //Arrange var brands = new Mock <IEfGenericRepository <Brand> >(); brands.Setup(x => x.Update(It.IsAny <Brand>())).Verifiable(); var brandsService = new BrandsService(brands.Object); var brand = DataHelper.GetBrand(); //Act brandsService.Update(brand); //Assert brands.Verify(x => x.Update(It.IsAny <Brand>()), Times.Once); }