CarbonFitnessTest.BusinessLogic.IngredientImporterTest.shouldThrowIngredientInsertionExceptionWhenInsertingFails C# (CSharp) Метод

shouldThrowIngredientInsertionExceptionWhenInsertingFails() приватный Метод

private shouldThrowIngredientInsertionExceptionWhenInsertingFails ( ) : void
Результат void
        public void shouldThrowIngredientInsertionExceptionWhenInsertingFails()
        {
            var factory = new MockFactory(MockBehavior.Strict);
            var ingredientRepositoryMock = factory.Create<IIngredientRepository>();
            ingredientRepositoryMock.Setup(x => x.SaveOrUpdate(It.IsAny<Ingredient>())).Throws(new Exception());

            Assert.Throws<IngredientInsertionException>(() => new IngredientImporter(null, null, ingredientRepositoryMock.Object).SaveIngredient(new Ingredient()));
        }