public void TestOutputValidRulesInvalidQuery()
        {
            ReadTextFile file     = new ReadTextFile();
            List <Item>  Items    = file.ReadFile("Test/TTtest3.txt");
            Process      function = new Process("TT", Items, file.Rules);

            Assert.AreEqual("NO", function.RunMethod());
        }
        public void TestOutputQueryItemThatIsPresetToTrue()
        {
            ReadTextFile file     = new ReadTextFile();
            List <Item>  Items    = file.ReadFile("Test/test6.txt");
            Process      function = new Process("TT", Items, file.Rules);

            Assert.AreEqual("YES: 8", function.RunMethod());
        }
        public void TestOutputMultiAndStatement()
        {
            ReadTextFile file     = new ReadTextFile();
            List <Item>  Items    = file.ReadFile("Test/TTtest1.txt");
            Process      function = new Process("TT", Items, file.Rules);

            Assert.AreEqual("YES: 3", function.RunMethod());
        }
        public void TestOutputNonExsistantQueryInRules()
        {
            ReadTextFile file     = new ReadTextFile();
            List <Item>  Items    = file.ReadFile("Test/TTtest2.txt");
            Process      function = new Process("TT", Items, file.Rules);

            Assert.AreEqual("NO", function.RunMethod());
        }
        public void TestOutputForGivenExample2()
        {
            ReadTextFile file     = new ReadTextFile();
            List <Item>  Items    = file.ReadFile("Test/GivenExample2.txt");
            Process      function = new Process("TT", Items, file.Rules);

            Assert.AreEqual("NO", function.RunMethod());
        }
Example #6
0
        public void TestOutputForGivenExample1()
        {
            ReadTextFile file     = new ReadTextFile();
            List <Item>  Items    = file.ReadFile("Test/GivenExample1.txt");
            Process      function = new Process("FC", Items, file.Rules);

            Assert.AreEqual("YES: a, b, p2, p3, p1, d", function.RunMethod());
        }
Example #7
0
        public void Test_ReadTextFile_Query()
        {
            ReadTextFile file  = new ReadTextFile();
            List <Item>  Items = file.ReadFile("Test/test1.txt");

            for (int i = 0; i < Items.Count; i++)
            {
                Assert.AreEqual(_expected[i].query, Items[i].query);
            }
        }
Example #8
0
        public void Test_ReadTextFile_Relation()
        {
            ReadTextFile file  = new ReadTextFile();
            List <Item>  Items = file.ReadFile("Test/test1.txt");

            for (int i = 0; i < Items.Count; i++)
            {
                for (int j = 0; j < Items[i].relations.Count; j++)
                {
                    for (int k = 0; k < Items[i].relations[j].name.Count; k++)
                    {
                        Assert.AreEqual(_expected[i].relations[j].name[k], Items[i].relations[j].name[k]);
                    }

                    Assert.AreEqual(_expected[i].relations[j].clause, Items[i].relations[j].clause);
                }
            }
        }
Example #9
0
        //this tests our method to write a text file and the method to read it
        public void checkWriteFile()
        {
            //arrange
            FullName nameOne = new FullName("Sally Anne ", "Smith");

            FullName[] names = new FullName[1];
            names[0] = nameOne;
            //act
            WriteTextFile wf = new WriteTextFile();
            ReadTextFile  rf = new ReadTextFile();

            //create a new text file for testing
            wf.WriteFile(names, "testtxt.txt");
            //now read it back
            System.Collections.Generic.List <string> actual   = rf.ReadFile("testtxt.txt");
            System.Collections.Generic.List <string> expected = new System.Collections.Generic.List <string>();
            expected.Add("Sally Anne Smith");
            //assert
            Assert.AreEqual(expected[0], actual[0]);
        }