Esempio n. 1
0
 /// <summary>
 /// Записать в базу поставщиков.
 /// </summary>
 /// <param name="converter"></param>
 private void LoadSuppliers(XMLConverter converter)
 {
     this.Logger.WriteLog("Downloading suppliers");
     try
     {
         foreach (var item in converter.GetSuppliers())
         {
             this.SupplierRepository.AddOrUpdateEntity(item);
         }
     }
     catch (Exception ex)
     {
         this.Logger.WriteLog(string.Format("{0}: {1}: {2}. {3}", "Error downloading suppliers", ex.Source, ex.Message, ex.StackTrace), LogTypes.WARNING);
     }
 }
Esempio n. 2
0
        public void GetSuppliersTest()
        {
            List <Supplier> expecterSuppliers = new List <Supplier>();

            expecterSuppliers.Add(new Supplier {
                Name = "Комос", GLN = "2313214214214", INN = "1234567890", KPP = "12345678", IsRoaming = false
            });
            expecterSuppliers.Add(new Supplier {
                Name = "Не комос", GLN = "2424422", INN = "123456355", KPP = "123548", IsRoaming = true
            });

            List <byte> bytes   = new List <byte>();
            var         bytesAr = File.ReadAllBytes("TestExchange.xml");

            foreach (var item in bytesAr)
            {
                bytes.Add(item);
            }

            XMLConverter converter = new XMLConverter(bytes, new Logger("Log.log", "Testing"));

            List <Supplier> gettedSuppliers = converter.GetSuppliers();

            if (expecterSuppliers.Count != gettedSuppliers.Count)
            {
                Assert.Fail("Количество клиентов не совпадает");
            }

            foreach (var item in expecterSuppliers)
            {
                Console.WriteLine(item);
            }
            foreach (var item in gettedSuppliers)
            {
                Console.WriteLine(item);
            }
            Assert.IsTrue(expecterSuppliers.All(gettedSuppliers.Contains));
        }