Esempio n. 1
0
        public async void CannotDeleteInstruction()
        {
            DbContextOptions <CookBookDbContext> options = new DbContextOptionsBuilder <CookBookDbContext>().UseInMemoryDatabase("CannotDeleteInstruction").Options;

            using (CookBookDbContext context = new CookBookDbContext(options))
            {
                //Arrange
                Instructions recipe = new Instructions();
                recipe.RecipeID     = 1;
                recipe.StepNumberID = 2;
                recipe.Action       = "Boil water";
                Instructions recipe2 = new Instructions();
                recipe2.RecipeID     = 3;
                recipe2.StepNumberID = 4;
                recipe2.Action       = "Mash taters";

                //Act
                InstructionsController instructionsController = new InstructionsController(context, configuration);
                await instructionsController.Post(recipe);

                await instructionsController.Post(recipe2);

                var result = await instructionsController.Delete(5, 5);

                //Assert
                Assert.IsType <NotFoundResult>(result);
            }
        }