/// <summary>
        /// Metoda dodaje dane to lisy zamówieñ
        /// </summary>
        private void TestData()
        {
            string pathApplication = Directory.GetCurrentDirectory();
            string pathDirectory   = pathApplication.Remove(pathApplication.IndexOf(@"t\bin\D") + 1);
            string pathFile        = System.IO.Path.Combine(pathDirectory, @"TestFiles\z.csv");

            ReadData.CsvToList(pathFile);
        }
Пример #2
0
        public void CsvToListTest()
        {
            //Arrange
            string pathApplication = Directory.GetCurrentDirectory();
            string pathDirectory   = pathApplication.Remove(pathApplication.IndexOf(@"t\bin\D") + 1);
            string pathFile        = System.IO.Path.Combine(pathDirectory, @"TestFiles\z.csv");
            int    count           = 6;

            //Act
            ReadData.CsvToList(pathFile);
            int countAct = Order.orders.Count;

            //Assert
            Assert.AreEqual(count, countAct);

            Order.orders.RemoveRange(0, countAct);
        }
 /// <summary>
 /// Metoda rozpoznaje format pliku i wyołuje odpowiedne metody do ich odczytu
 /// </summary>
 /// <param name="fileList"></param>
 private static void ReadListFiles(List <string> fileList)
 {
     foreach (var item in fileList)
     {
         if (item.EndsWith(".csv"))
         {
             ReadData.CsvToList(item);
         }
         else if (item.EndsWith(".xml"))
         {
             ReadData.XmlToList(item);
         }
         else if (item.EndsWith(".json"))
         {
             ReadData.JsonToList(item);
         }
         else
         {
             Console.ForegroundColor = ConsoleColor.Red;
             Console.WriteLine("Plik: " + item + " - ma nieodpowiedni format");
             Console.ResetColor();
         }
     }
 }