示例#1
0
        public void CanReadGood()
        {
            //Arrange
            string path = @"Assets/list.txt";
            string food = "I need: nutella, salad, milk, eggs, bacon";

            //act

            // File.WriteAllText(path, lists);
            string result = NomsList.ViewList(path);

            Assert.Equal(food, result);
        }
示例#2
0
        public void CanReadGood()
        {
            //Arrange
            string path = @"Assets/readTest.txt";

            string[] foodArray = new string[5] {
                "nutella", "salad", "milk", "eggs", "bacon"
            };
            File.WriteAllLines(path, foodArray);
            string expected = "nutella, salad, milk, eggs, bacon,";

            //act
            string result = NomsList.ViewList(path);

            // File.WriteAllText(path, lists);

            Assert.Equal(expected, result);
        }
示例#3
0
        public void CanEraseGood()
        {
            //Arrange
            string path = @"Assets/deleteTest.txt";

            string[] foodArray = new string[5] {
                "nutella", "salad", "milk", "eggs", "bacon"
            };
            File.WriteAllLines(path, foodArray);
            string expected = "nutella, milk, eggs, bacon,";

            //Act
            NomsList.DelItem(path, "salad");
            string result = NomsList.ViewList(path);


            //Assert
            Assert.Equal(expected, result);
        }
示例#4
0
        //testing to see if the method can add an item
        public void CanWriteGood()
        {
            //Arrange
            string path = @"Assets/append.txt";

            string[] lists = new string[] { "ayyyy" };
            File.WriteAllLines(path, lists);
            string woo = "pies";

            //Act
            NomsList.AddItem(path, woo);
            string[] lolol     = new string[] { "ayyyy", "pies" };
            string[] result    = File.ReadAllLines(path);
            string   result2   = NomsList.ViewList(path);
            string   expected2 = "ayyyy, pies,";

            //Assert
            Assert.Equal(lolol, result);
            Assert.Equal(expected2, result2);
        }