Esempio n. 1
0
        static void Main(string[] args)
        {
            Store          store    = new Store("Универмаг");
            List <Product> products = new List <Product>();
            Basket         basket   = new Basket();

            FileLoadStore(store);
            DataBaseFileLoad(products);
            ServiceSerializationDB.SerializeObjectInXML(products, "DataBase1.xml");
            List <Product> newListProducts = ServiceSerializationDB.DeserializeObject("DataBase1.xml");

            //foreach(Product product in newListProducts)
            //{
            //    Console.WriteLine(product.ToString());
            //}
            try
            {
                ApplicationMenu(store, products, basket);
            }
            catch (ArgumentOutOfRangeException ex)
            {
                Console.WriteLine(ex.Message);
            }
            catch (FormatException ex)
            {
                Console.WriteLine(ex.Message);
            }
            catch (ArgumentNullException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Esempio n. 2
0
        public void SerializeTest_Count()
        {
            string pathFile = "FileXML1.xml";

            ServiceSerializationDB.SerializeObjectInXML(products1, pathFile);
            products2 = ServiceSerializationDB.DeserializeObject(pathFile);

            Assert.AreEqual(products1.Count, products2.Count);
        }