public void Tag_AddTagsToOneRecipe_True()
        {
            //arrange = manual data
            // add one recipe and two tags
            Recipe newRecipe = new Recipe("soup", "heat up");

            newRecipe.Save();

            Tag firstTag  = new Tag("first");
            Tag secondTag = new Tag("second");

            firstTag.Save();
            secondTag.Save();

            //Act
            newRecipe.AddTag(firstTag);
            newRecipe.AddTag(secondTag);

            List <Tag> result   = newRecipe.GetTags();
            List <Tag> expected = new List <Tag> {
                firstTag, secondTag
            };

            Assert.Equal(result, expected);
        }
Example #2
0
        public void AddTag_AddTagsToOneRecipe_True()
        {
            //Arrange
            Recipe testRecipe = new Recipe("Soup", "Heat up Soup");

            testRecipe.Save();

            Tag firstTag = new Tag("Hearty");

            firstTag.Save();
            Tag secondTag = new Tag("Soupy");

            secondTag.Save();
            //Act
            testRecipe.AddTag(firstTag);
            testRecipe.AddTag(secondTag);

            List <Tag> result   = testRecipe.GetTags();
            List <Tag> testList = new List <Tag> {
                firstTag, secondTag
            };

            //Assert
            Assert.Equal(testList, result);
        }
        public void GetTags_ReturnAllTagsFromOneRecipe_True()
        {
            Recipe testRecipe = new Recipe("soup", "heat the soup");

            testRecipe.Save();

            Tag firstTag  = new Tag("soupy");
            Tag secondTag = new Tag("tasty");

            firstTag.Save();
            secondTag.Save();

            testRecipe.AddTag(firstTag);
            testRecipe.AddTag(secondTag);
            List <Tag> expectedTags = new List <Tag> {
                firstTag, secondTag
            };
            List <Tag> resultTags = testRecipe.GetTags();

            Assert.Equal(resultTags, expectedTags);
        }
Example #4
0
        public void GetTags_ReturnsAllTagsFromOneRecipe_True()
        {
            //Arrange
            Recipe testRecipe = new Recipe("Soup", "Heat that soup!");

            testRecipe.Save();

            Tag firstTag = new Tag("Hearty");

            firstTag.Save();
            Tag secondTag = new Tag("Soupy");

            secondTag.Save();
            //Act
            testRecipe.AddTag(firstTag);
            testRecipe.AddTag(secondTag);
            List <Tag> testTags   = testRecipe.GetTags();
            List <Tag> contolTags = new List <Tag> {
                firstTag, secondTag
            };

            //Assert
            Assert.Equal(contolTags, testTags);
        }