public void ArrayLinkTest()
 {
     var oddsValues = new OddValue[]
     {
         new OddValue()
         {
             DuelLink = new DuelLink()
             {
                 DuelLinkId = 0,
                 Name       = "test",
                 Url        = "google.com"
             }
         },
         new OddValue()
         {
             DuelLink = new DuelLink()
             {
                 DuelLinkId = 1,
                 Name       = "test1",
                 Url        = "google.com"
             }
         },
         new OddValue()
         {
             DuelLink = new DuelLink()
             {
                 DuelLinkId = 2,
                 Name       = "test",
                 Url        = "google.com"
             }
         }
     };
     var duelLinks = oddsValues.Select(x => x.DuelLink).Distinct().ToArray();
 }
Beispiel #2
0
        private OddValue SetOddValuesAh(DuelLink duelLink, int group)
        {
            List <Counter> counters  = new List <Counter>();
            string         gameValue = "";

            IList <IWebElement> containers = SafeTryFindElements(_attemptsCount, ".table-container").Where(x => !x.GetCssValue("display").Equals("none")).ToList();

            if (!containers.Any())
            {
                return(null);
            }

            foreach (var container in containers)
            {
                //Delay();
                List <IWebElement> linksList     = container.FindElements(By.CssSelector(".odds-co a")).ToList();
                List <string>      countersList  = container.FindElements(By.CssSelector(".odds-cnt")).Select(x => x.Text).ToList();
                List <string>      gameValueList = container.FindElements(By.CssSelector("strong")).Select(x => x.Text).ToList();
                List <string>      games         = new List <string>();

                foreach (var game in gameValueList)
                {
                    if (game.Contains("Asian handicap "))
                    {
                        games.Add(game.Replace("Asian handicap ", ""));
                    }

                    if (game.Contains("Over/Under "))
                    {
                        games.Add(game.Replace("Over/Under ", ""));
                    }
                }
                if (linksList.Count > 0 && countersList.Count > 0)
                {
                    IWebElement link = linksList.FirstOrDefault();         // SafeTryFindElements(_attemptsCount, ".odds-co a").FirstOrDefault();

                    string counterElement = countersList.FirstOrDefault(); //SafeTryFindElements(_attemptsCount, ".odds-cnt").FirstOrDefault();

                    gameValue = games.FirstOrDefault();

                    string counterString = counterElement.Replace("(", "")
                                           .Replace(")", "");

                    int counter = 0;
                    if (Int32.TryParse(counterString, out counter))
                    {
                        counters.Add(new Counter
                        {
                            Value          = counter,
                            Link           = link,
                            ElementContext = container
                        });
                    }
                }
            }

            int            max         = counters.Max(x => x.Value);
            List <Counter> maxCounters = counters.Where(x => x.Value == max).ToList();

            bool actionsSucceeded = true;

            CloseAllTableContainers();

            FindHigh finalElement = FindFinalElement(maxCounters, gameValue);

            if (finalElement != null)
            {
                OddValue value = new OddValue()
                {
                    DuelLink      = duelLink,
                    Group         = group,
                    GameValue     = finalElement.GameValue,
                    Average1      = finalElement.AverageString.FindElement(By.CssSelector(".right:nth-child(3)")).Text,
                    Average2      = finalElement.AverageString.FindElement(By.CssSelector(".right:nth-child(4)")).Text,
                    AveragePayout = finalElement.AverageString.FindElement(By.CssSelector(".aver .center")).Text,
                    Highest1      = finalElement.HighString.FindElement(By.CssSelector(".right:nth-child(3)")).Text,
                    Highest2      = finalElement.HighString.FindElement(By.CssSelector(".right:nth-child(4)")).Text,
                    HighestPayout = finalElement.HighString.FindElement(By.CssSelector(".center")).Text,
                    Tab           = _driver.FindElement(By.CssSelector(".ul-nav>.active")).Text
                };
                return(value);
            }
            return(null);
        }
Beispiel #3
0
 private void AddOddValue(OddValue value, Teams teams)
 {
     value.TeamsLink = teams;
     _oddsValues.Add(value);
 }