public void GetManufacturerPartNoTest()
        {
            try
            {
                DigikeyTools dkt = new DigikeyTools();
                dkt.SetPartNumberData("497-14045-ND");
                string ManufacturerPN;

                using (IWebDriver webdriver = new FirefoxDriver())
                {
                    webdriver.Navigate().GoToUrl(dkt.Url);
                    var wait = new WebDriverWait(webdriver, TimeSpan.FromSeconds(60));

                    string yourtext = webdriver.FindElement(By.TagName("body")).Text;

                    dkt.SetPageData(webdriver.PageSource);

                    Currency.AddExhangeRate("USD", dkt.DefDestCurrency);

                    ManufacturerPN = dkt.GetManufacturerPartNo();
                }


                Assert.IsTrue(ManufacturerPN == "STM32F030R8T6");
            }
            catch (Exception ex)
            {
                Assert.Fail("Digikey GetManufacturerPartNoTest Failed: " + ex.ToString());
            }
        }
Esempio n. 2
0
        public void GetManufacturerTest()
        {
            try
            {
                MouserWebtools mwt = new MouserWebtools();
                mwt.SetPartNumberData("STM32F030R8T6");
                string manufacturer;

                using (IWebDriver webdriver = new FirefoxDriver())
                {
                    webdriver.Navigate().GoToUrl(mwt.Url);
                    var wait = new WebDriverWait(webdriver, TimeSpan.FromSeconds(60));

                    string yourtext = webdriver.FindElement(By.TagName("body")).Text;

                    mwt.SetPageData(webdriver.PageSource);

                    Currency.AddExhangeRate("USD", mwt.DefDestCurrency);

                    manufacturer = mwt.GetManufacturer();
                }


                Assert.IsTrue(manufacturer == "STMicroelectronics");
            }
            catch (Exception ex)
            {
                Assert.Fail("Mouser GetManufacturerTest Failed: " + ex.ToString());
            }
        }
Esempio n. 3
0
        public void GetPricingInfoTest()
        {
            try
            {
                OttoMarketingWebTools omwt = new OttoMarketingWebTools();
                omwt.SetPartNumberData("sim5300e");
                PricingInfo[] priceinfo;

                using (IWebDriver webdriver = new FirefoxDriver())
                {
                    webdriver.Navigate().GoToUrl(omwt.Url);
                    var wait = new WebDriverWait(webdriver, TimeSpan.FromSeconds(60));

                    string yourtext = webdriver.FindElement(By.TagName("body")).Text;

                    omwt.SetPageData(webdriver.PageSource);

                    Currency.AddExhangeRate("USD", omwt.DefDestCurrency);

                    priceinfo = omwt.GetPricingInfo();
                }


                Assert.IsTrue(
                    (priceinfo.Count() == 1) &&
                    (priceinfo[0].minqty == 1) && (priceinfo[0].maxqty == 999999) && (priceinfo[0].SrcCost == 304.50)
                    );
            }
            catch (Exception ex)
            {
                Assert.Fail("Mouser GetPricingInfoTest Failed: " + ex.ToString());
            }
        }
Esempio n. 4
0
        public void GetManufacturerPartNoTest()
        {
            try
            {
                MantechWebTools mtt = new MantechWebTools();
                mtt.SetPartNumberData("65M0880-H");
                string ManufacturerPN;

                using (IWebDriver webdriver = new FirefoxDriver())
                {
                    webdriver.Navigate().GoToUrl(mtt.Url);
                    var wait = new WebDriverWait(webdriver, TimeSpan.FromSeconds(60));

                    string yourtext = webdriver.FindElement(By.TagName("body")).Text;

                    mtt.SetPageData(webdriver.PageSource);

                    Currency.AddExhangeRate("USD", mtt.DefDestCurrency);

                    ManufacturerPN = mtt.GetManufacturerPartNo();
                }


                Assert.IsTrue(ManufacturerPN == "PHSP87C54X2FBDX");
            }
            catch (Exception ex)
            {
                Assert.Fail("Mantech GetPricingInfoTest Failed: " + ex.ToString());
            }
        }
Esempio n. 5
0
        public void GetPricingInfoTest()
        {
            try
            {
                MantechWebTools mtt = new MantechWebTools();
                mtt.SetPartNumberData("65M0880-H");
                PricingInfo[] priceinfo;

                using (IWebDriver webdriver = new FirefoxDriver())
                {
                    webdriver.Navigate().GoToUrl(mtt.Url);
                    var wait = new WebDriverWait(webdriver, TimeSpan.FromSeconds(60));

                    string yourtext = webdriver.FindElement(By.TagName("body")).Text;

                    mtt.SetPageData(webdriver.PageSource);

                    Currency.AddExhangeRate("USD", mtt.DefDestCurrency);

                    priceinfo = mtt.GetPricingInfo();
                }


                Assert.IsTrue(
                    (priceinfo.Count() == 3) &&
                    (priceinfo[0].minqty == 1) && (priceinfo[0].maxqty == 50) && (priceinfo[0].SrcCost == 40.71) &&
                    (priceinfo[1].minqty == 51) && (priceinfo[1].maxqty == 100) && (priceinfo[1].SrcCost == 30.53) &&
                    (priceinfo[2].minqty == 101) && (priceinfo[2].maxqty == 999999) && (priceinfo[2].SrcCost == 26.46)
                    );
            }
            catch (Exception ex)
            {
                Assert.Fail("Mantech GetPricingInfoTest Failed: " + ex.ToString());
            }
        }
        private bool TestPart(string pn, Price[] prices)
        {
            try
            {
                int          count = prices.Length;
                DigikeyTools dkt   = new DigikeyTools();
                dkt.SetPartNumberData(pn);
                PricingInfo[] priceinfo;

                using (IWebDriver webdriver = new FirefoxDriver())
                {
                    webdriver.Navigate().GoToUrl(dkt.Url);
                    var wait = new WebDriverWait(webdriver, TimeSpan.FromSeconds(60));

                    string yourtext = webdriver.FindElement(By.TagName("body")).Text;

                    dkt.SetPageData(webdriver.PageSource);

                    Currency.AddExhangeRate("USD", dkt.DefDestCurrency);

                    priceinfo = dkt.GetPricingInfo();
                }

                bool Passed = true;
                if (priceinfo.Count() == count)
                {
                    int i;

                    for (i = 0; i < count; i++)
                    {
                        if ((priceinfo[i].minqty != prices[i].minqty) || (priceinfo[i].maxqty != prices[i].maxqty) || (priceinfo[i].SrcCost != prices[i].price))
                        {
                            Passed = false;
                        }
                    }
                }
                else
                {
                    Passed = false;
                }

                return(Passed);
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("Part test ({0}) failed", pn), ex);
            }
        }
Esempio n. 7
0
        public void GetPricingInfoTest()
        {
            try
            {
                rswebtools rswt = new rswebtools(@"http://za.rs-online.com/web/p/microcontrollers/");
                rswt.SetPartNumberData("7925934");
                PricingInfo[] priceinfo;
                string        page1;
                string        page2;

                using (IWebDriver webdriver = new FirefoxDriver())
                {
                    webdriver.Navigate().GoToUrl(rswt.Url);
                    var wait = new WebDriverWait(webdriver, TimeSpan.FromSeconds(60));

                    page1 = webdriver.PageSource;
                }

                using (IWebDriver webdriver = new FirefoxDriver())
                {
                    webdriver.Navigate().GoToUrl(rswt.UrlProductionQty);
                    var wait = new WebDriverWait(webdriver, TimeSpan.FromSeconds(60));

                    page2 = webdriver.PageSource;
                }

                string merged = WebPage.Merge(page1, page2);

                rswt.SetPageData(merged);
                Currency.AddExhangeRate("USD", rswt.DefDestCurrency);
                priceinfo = rswt.GetPricingInfo();

                Assert.IsTrue(
                    (priceinfo.Count() == 5) &&
                    (priceinfo[0].minqty == 5) && (priceinfo[0].maxqty == 24) && (priceinfo[0].SrcCost == 37.31) &&
                    (priceinfo[1].minqty == 25) && (priceinfo[1].maxqty == 99) && (priceinfo[1].SrcCost == 39.662) &&
                    (priceinfo[2].minqty == 100) && (priceinfo[2].maxqty == 249) && (priceinfo[2].SrcCost == 38.076) &&
                    (priceinfo[3].minqty == 250) && (priceinfo[3].maxqty == 2499) && (priceinfo[3].SrcCost == 36.552) &&
                    (priceinfo[4].minqty == 2500) && (priceinfo[4].maxqty == 999999) && (priceinfo[4].SrcCost == 35.09)
                    );
            }
            catch (Exception ex)
            {
                Assert.Fail("RS GetPricingInfoTest Failed: " + ex.ToString());
            }
        }
Esempio n. 8
0
        public void GetManufacturerTest()
        {
            try
            {
                rswebtools rswt = new rswebtools(@"http://za.rs-online.com/web/p/microcontrollers/");
                rswt.SetPartNumberData("7925934");
                string manufacturer;
                string page1;
                string page2;

                using (IWebDriver webdriver = new FirefoxDriver())
                {
                    webdriver.Navigate().GoToUrl(rswt.Url);
                    var wait = new WebDriverWait(webdriver, TimeSpan.FromSeconds(60));

                    page1 = webdriver.PageSource;
                }

                using (IWebDriver webdriver = new FirefoxDriver())
                {
                    webdriver.Navigate().GoToUrl(rswt.UrlProductionQty);
                    var wait = new WebDriverWait(webdriver, TimeSpan.FromSeconds(60));

                    page2 = webdriver.PageSource;
                }

                string merged = WebPage.Merge(page1, page2);

                rswt.SetPageData(merged);
                Currency.AddExhangeRate("USD", rswt.DefDestCurrency);
                manufacturer = rswt.GetManufacturer();

                Assert.IsTrue(manufacturer == "STMicroelectronics");
            }
            catch (Exception ex)
            {
                Assert.Fail("RS GetManufacturerTest Failed: " + ex.ToString());
            }
        }