Beispiel #1
0
        public IMessageIn Visit(ProductDepth msg)
        {
            if (_data == null)
            {
                return(msg);
            }
            // {
            //   "bids": [[432.76, 3.55],...],
            //   "asks": [[440.01, 3.15],...],
            //   "timestamp":"1451920248246",
            // }
            msg.Timestamp = Util.Time.FromUnixMillis((long)_data["timestamp"]);
            msg.Orders    = new List <Amount>();
            Action <string, Side> ParseOrders = (field, side) =>
            {
                JArray orders = (JArray)_data[field];
                Condition.Requires(orders, "orders").IsNotNull();
                foreach (var pair in orders)
                {
                    msg.Orders.Add(new Amount()
                    {
                        Side     = side,
                        Price    = pair[0].AsDecimal(),
                        Quantity = pair[1].AsDecimal(),
                    });
                }
            };

            ParseOrders("bids", Side.Buy);
            ParseOrders("asks", Side.Sell);
            return(msg);
        }
        internal void AddNewProduct()
        {
            ExcelLib.PopulateInCollection(InventoryTest.ExcelPath, "ProductPage");

            Thread.Sleep(2000);
            //Select Invenotory menu
            Invetory.Click();
            Thread.Sleep(2000);
            //Select Product menu
            Product.Click();
            Thread.Sleep(2000);
            //Select Add New Product from menu
            AddProduct.Click();
            Thread.Sleep(2000);

            //sending product code
            ProductCode.SendKeys(ExcelLib.ReadData(2, "ProductCode"));
            Thread.Sleep(1000);
            //sending product desc
            ProductDesc.SendKeys(ExcelLib.ReadData(2, "ProductDesc"));
            Thread.Sleep(1000);
            //sending barcode
            Barcode.SendKeys(ExcelLib.ReadData(2, "Barcode"));
            Thread.Sleep(1000);
            //sending Unitof measure
            //UnitOfMesureClick.Click();
            //Thread.Sleep(2000);
            //UnitOfMesure.SendKeys(ExcelLib.ReadData(2, "UnitOfMesure"));

            var UnitOfMesure       = CommonMethods.driver.FindElement(By.Id("Product_UnitOfMeasureId"));
            var selectUnitOfMesure = new SelectElement(UnitOfMesure);

            Thread.Sleep(1000);
            selectUnitOfMesure.SelectByText(ExcelLib.ReadData(2, "UnitOfMesure"));


            //sending Product group
            //ProductGrp.SendKeys(ExcelLib.ReadData(2, "ProductGroup"));

            var ProductGrpList  = CommonMethods.driver.FindElement(By.Id("Product_ProductGroupId"));
            var selectProGrpVal = new SelectElement(ProductGrpList);

            Thread.Sleep(1000);
            selectProGrpVal.SelectByText(ExcelLib.ReadData(2, "ProductGroup"));
            Thread.Sleep(1000);
            //sending Pack size
            PackSize.SendKeys(ExcelLib.ReadData(2, "PackSize"));
            Thread.Sleep(1000);
            //Sending Weight
            ProductWeight.SendKeys(ExcelLib.ReadData(2, "ProductWeight"));
            Thread.Sleep(1000);
            //Sending Product width
            ProductWidth.SendKeys(ExcelLib.ReadData(2, "ProductWidth"));
            Thread.Sleep(1000);
            //sending Product Height
            ProductHeight.SendKeys(ExcelLib.ReadData(2, "ProductHeight"));
            Thread.Sleep(1000);
            //sending ProductDepth
            ProductDepth.SendKeys(ExcelLib.ReadData(2, "ProductDepth"));
            Thread.Sleep(1000);

            ////select Types
            //NeverDimishing.Click();
            //Thread.Sleep(1000);
            ////CommonMethods.driver.SwitchTo().Alert().Dismiss();
            //Obsolete.Click();
            //Thread.Sleep(1000);
            ////CommonMethods.driver.SwitchTo().Alert().Dismiss();

            //Sending Notes
            Notes.SendKeys(ExcelLib.ReadData(2, "Notes"));
            //savedata
            SaveBtn.Click();
            Thread.Sleep(2000);
            ProductView.Click();
            Thread.Sleep(1000);
            ProductCodeFilter.SendKeys(ExcelLib.ReadData(2, "ProductCode"));
            Thread.Sleep(1000);
            //press enter
            ProductCodeFilter.SendKeys(Keys.Enter);
            Thread.Sleep(4000);


            try
            {
                //verify record is added
                if (ExcelLib.ReadData(2, "ProductCode") == CommonMethods.driver.FindElement(By.XPath(".//*[@id='ProductList_tccell0_2']/div/a")).Text)
                {
                    if (ExcelLib.ReadData(2, "ProductDesc") == CommonMethods.driver.FindElement(By.XPath(".//*[@id='ProductList_tccell0_3']/div/a")).Text)
                    {
                        if (ExcelLib.ReadData(2, "ProductGrp") == CommonMethods.driver.FindElement(By.XPath(".//*[@id='ProductList_tccell0_3']/div/a")).Text)
                        {
                            SaveScreenShotClass.SaveScreenshot(CommonMethods.driver, "Found Added Product ");
                        }
                    }
                }
                else
                {
                    SaveScreenShotClass.SaveScreenshot(CommonMethods.driver, "No record found ");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Can not find added Product,Test failed" + e.Message);
            }
        }
Beispiel #3
0
 public string Visit(ProductDepth msg)
 {
     return(MarketData(msg.Product, OkCoin.MarketData.Depth60));
 }