예제 #1
0
        public async Task ReturnInstanceOfTypeCocktailIngredient()
        {
            //Arrange
            var options = TestUtilities.GetOptions(nameof(ReturnInstanceOfTypeCocktailIngredient));
            var id      = Guid.NewGuid();
            var id2     = Guid.NewGuid();

            var cocktail = new Cocktail
            {
                Id   = id,
                Name = "testCocktail"
            };

            var ingredient = new Ingredient
            {
                Id   = id2,
                Name = "testIngredient"
            };

            using (var assertContext = new CWContext(options))
            {
                //Act & Assert
                var sut    = new CocktailIngredientService(assertContext);
                var result = await sut.CreateCocktailIngredientAsync(cocktail.Id, ingredient.Id);

                Assert.IsInstanceOfType(result, typeof(CocktailIngredient));
                Assert.AreEqual(cocktail.Id, result.CocktailId);
                Assert.AreEqual(ingredient.Id, result.IngredientId);
            }
        }
        public void Constructor_CreatesInstance()
        {
            //Arrange
            var options = TestUtilities.GetOptions(nameof(Constructor_CreatesInstance));

            using (var assertContext = new CWContext(options))
            {
                //Act
                var sut = new CocktailIngredientService(assertContext);

                //Assert
                Assert.IsNotNull(sut);
            }
        }