public void Test_Parser(int countProduct, string nameShope, string typeFile, string typeTest)
        {
            string sourse = null;

            try
            {
                managerShope             = new ManagerShope();
                shopeSetings             = managerShope.GetShope(nameShope);
                connectorShope           = new ConnectorShope(shopeSetings.urlShope, shopeSetings.prefPage, shopeSetings.typeReqvest);
                ManagerShope.listProduct = new List <Product>();
                sourse = GetDocument(typeFile, typeTest);
                shopeSetings.Parser(sourse, ref countProduct);
                Assert.AreEqual(test_Products.Count, ManagerShope.listProduct.Count);
                for (int i = 0; i < test_Products.Count; i++)
                {
                    Assert.AreEqual(test_Products[i].id, ManagerShope.listProduct[i].id);
                    Assert.AreEqual(test_Products[i].nameProduct, ManagerShope.listProduct[i].nameProduct);
                    Assert.AreEqual(test_Products[i].price, ManagerShope.listProduct[i].price);
                }
            }
            catch (InvalidDataException) { }
            catch (Exception)
            {
                Assert.Fail();
            }
        }
Exemple #2
0
 public void Test_GetShope(string nameShope, string url, string pref, string typeReqvest)
 {
     managerShope = new ManagerShope();
     try
     {
         shopeSetings = managerShope.GetShope(nameShope);
         if (shopeSetings != null)
         {
             Assert.AreEqual(url, shopeSetings.urlShope);
             Assert.AreEqual(pref, shopeSetings.prefPage);
             Assert.AreEqual(typeReqvest, shopeSetings.typeReqvest);
             Assert.AreEqual(nameShope, shopeSetings.nameShop);
         }
         else
         {
             Assert.Fail();
         }
     }
     catch (ArgumentNullException) { }
     catch (Exception e)
     {
         Assert.Fail(e.Message);
     }
 }