コード例 #1
0
        public async Task GetRecipe()
        {
            //Arrange
            Recipe recipe = new Recipe();

            recipe.Id          = 0;
            recipe.UserId      = 1;
            recipe.Title       = "recipe2";
            recipe.Slug        = "00-recipe2";
            recipe.Instruction = "instruction2";
            recipe.CreatedAt   = DateTime.Now;

            //Act
            var addResult = await recipeRepository.AddAsync(recipe);

            var getResult = await recipeRepository.GetByIdAsync(addResult.Id);

            //Assert
            Assert.IsNotNull(addResult);
            Assert.IsNotNull(getResult);
            Assert.AreEqual(addResult.Id, getResult.Id);
            Assert.AreEqual(addResult.Title, getResult.Title);
            Assert.AreEqual(addResult.Instruction, getResult.Instruction);
        }