Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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);
        }