Пример #1
0
        public async void CannotGetOneInstruction()
        {
            DbContextOptions <CookBookDbContext> options = new DbContextOptionsBuilder <CookBookDbContext>().UseInMemoryDatabase("CannotGetOneInstruction").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();
                recipe.RecipeID     = 2;
                recipe.StepNumberID = 1;
                recipe.Action       = "Mash taters";
                Instructions recipe3 = new Instructions();
                recipe.RecipeID     = 3;
                recipe.StepNumberID = 1;
                recipe.Action       = "Beat eggs";

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

                await InstructionsController.Post(recipe2);

                await InstructionsController.Post(recipe3);

                var result = InstructionsController.Get(4, 5);

                //Assert
                Assert.IsType <NotFoundResult>(result);
            }
        }
Пример #2
0
        public void Get_Returns_List_Of_Instructions()
        {
            var expected = new List <Instructions>();

            repo.GetAll().Returns(expected);

            var result = underTest.Get();

            Assert.IsType <List <Instructions> >(result.Value);
        }