Exemple #1
0
 public void EmptyFile()
 {
     try
     {
         string fileName             = "_Test_EmptyFile.txt";
         Lab3.Floyd_Warshall algTest = new Floyd_Warshall(fileName);
     }
     catch (Exception e)
     {
         Assert.AreEqual(e.Message, "Empty file!");
     }
 }
Exemple #2
0
        public void CheckCorrectPath_RoadToCity_StraightWay()
        {
            List <string> test = new List <string>()
            {
                "СПб", "Москва"
            };
            string fileName = "_Test_Example.txt";

            Lab3.Floyd_Warshall algTest = new Floyd_Warshall(fileName);

            Assert.AreEqual(test.SequenceEqual(algTest.Path("СПб", "Москва")), true);
        }
Exemple #3
0
 public void NotEnoughArgumentsInFile()
 {
     try
     {
         string fileName             = "_Test_NotEnoughArguments.txt";
         Lab3.Floyd_Warshall algTest = new Floyd_Warshall(fileName);
     }
     catch (Exception e)
     {
         Assert.AreEqual(e.Message, "Invalid file filling format! On 1 line; one of the arguments is an empty string!");
     }
 }
Exemple #4
0
 public void IncorrectPathFormat_Range()
 {
     try
     {
         string fileName             = "_Test_IncorrectPathFormat_Range.txt";
         Lab3.Floyd_Warshall algTest = new Floyd_Warshall(fileName);
     }
     catch (Exception e)
     {
         Assert.AreEqual(e.Message, "Invalid file filling format! On 1 line; 3 argument (not number)");
     }
 }
Exemple #5
0
        public void CheckCorrectPath_RoadToCity_ManyPoints()
        {
            List <string> test = new List <string>()
            {
                "Москва", "СПб", "Владивосток"
            };

            string fileName = "_Test_Example.txt";

            Lab3.Floyd_Warshall algTest = new Floyd_Warshall(fileName);

            Assert.AreEqual(test.SequenceEqual(algTest.Path("Москва", "Владивосток")), true);
        }
Exemple #6
0
        public void CheckCities()
        {
            List <string> test = new List <string>()
            {
                "СПб", "Москва", "Хабаровск", "Владивосток"
            };

            string fileName = "_Test_Example.txt";

            Lab3.Floyd_Warshall algTest = new Floyd_Warshall(fileName);

            Assert.AreEqual(test.SequenceEqual(algTest.cities), true);
        }
Exemple #7
0
 public void CheckCorrectPath_IncorrectNameCity()
 {
     try
     {
         string fileName             = "_Test_Example.txt";
         Lab3.Floyd_Warshall algTest = new Floyd_Warshall(fileName);
         algTest.Path("Москва", "Сельдерей");
     }
     catch (Exception e)
     {
         Assert.AreEqual(e.Message, "You entered incorrect name of second city!");
     }
 }
Exemple #8
0
        public void CheckCorrectPath_NoWay()
        {
            try
            {
                string fileName             = "_Test_NoWay.txt";
                Lab3.Floyd_Warshall algTest = new Floyd_Warshall(fileName);

                var testtt = algTest.Path("1", "2");
            }
            catch (Exception e)
            {
                Assert.AreEqual(e.Message, "There is no way!");
            }
        }