Exemplo n.º 1
0
 /// <summary>
 /// <para>Converter from array of struct to array of objects</para>
 /// </summary>
 /// <param name="aliGoods">Array with objects</param>
 public void ConverterStructGoodsToClass(AliGoods[] aliGoods)
 {
     for (int i = 0; i < SuperPage.countPhone; i++)
     {
         aliGoods[i]        = new AliGoods();
         aliGoods[i].Name   = SuperPage.phones[i].name;
         aliGoods[i].Price  = SuperPage.phones[i].price;
         aliGoods[i].Orders = SuperPage.phones[i].orders;
     }
 }
        /// <summary>
        /// <para>Top saling test</para>
        /// </summary>
        public void TopSalling()
        {
            ChromeOptions options = new ChromeOptions();

            options.PageLoadStrategy = PageLoadStrategy.None;
            using (ChromeDriver dr = new ChromeDriver(Directory.GetCurrentDirectory(), options))
            {
                SuperPage.phones = new Phone[144];
                HelpClass helper = new HelpClass();

                var mainPage = new MainPage(dr);
                mainPage.GoToMainPage();
                try
                {
                    mainPage.CloseAdvertasing();
                }
                catch { }
                var searchPage1 = mainPage.GoToTheSearchPhones();
                searchPage1.FindAndWriteTopPhones();

                var searchPage2 = searchPage1.GoToSecondPage();
                searchPage2.FindAndWriteTopPhones();

                var searchPage3 = searchPage2.GoToThirdPage();
                searchPage3.FindAndWriteTopPhones();

                AliGoods[] aliGoods = new AliGoods[SuperPage.countPhone];
                helper.ConverterStructGoodsToClass(aliGoods);
                aliGoods.Clone();
                MsSql msSql = new MsSql();
                msSql.ClearTable("aligoods");
                msSql.AddRange(aliGoods);

                ArrayList getsFromDataBase = new ArrayList();
                getsFromDataBase = msSql.GetAll("aliGoods");

                int countphone = 0;
                foreach (AliGoods element in getsFromDataBase)
                {
                    Assert.IsTrue(element.EqualsGoods(aliGoods[countphone++]));
                }
                msSql.CloseAllConnections();
            }
        }
Exemplo n.º 3
0
 public bool EqualsGoods(AliGoods aliGoods)
 {
     return(this.Orders == aliGoods.Orders);
 }