Exemple #1
0
        public void TestCompetitionParsing()
        {
            string url = "https://www.transfermarkt.pt/serie-a/startseite/wettbewerb/IT1";

            url = "https://www.transfermarkt.pt/liga-nos/startseite/wettbewerb/PO1/plus/?saison_id=2019";
            CompetitionPage page = new CompetitionPage(new HAPConnection(), logger);

            page.Parse(url);

            var domain = page.Domain;

            Assert.IsNotNull(domain, "The returned Domain is null.");

            TestingConfigs.DomainElementsCheck(domain);

            // Clubs
            for (int i = 0; i < domain.Children.Count; i++)
            {
                var clubChild = domain.Children[i];
                TestingConfigs.DomainElementsCheck(clubChild);

                for (int j = 0; j < clubChild.Children.Count; j++)
                {
                    var playerChild = clubChild.Children[j];
                    TestingConfigs.DomainElementsCheck(playerChild);
                }
            }
        }
        private CompetitionPage InitCompetitionPage(IList <QuestionBook> books)
        {
            var competition = new Competition()
            {
                Participants = new List <CompetitionParticipant>(),
                Answers      = new List <CompetitionAnswer>()
            };
            var page = new CompetitionPage(books);

            page.QuestionBookSelected += book =>
            {
                if (competition.Participants.Count > 0)
                {
                    competition.QuestionBook = book;
                    OnCompetitionReady(competition);
                }

                //MessageBox.Show(this, $"{book.Name}被选择!", "提示");
            };
            page.ParticipantJoin += no =>
            {
                var participant = competition.Participants.FirstOrDefault(t => t.No == no);
                if (participant == null)
                {
                    competition.Participants.Add(new CompetitionParticipant()
                    {
                        Id = Guid.NewGuid(),
                        No = no,
                    });
                }
            };
            page.OnParticipantKeyDown(this, new ParticipantKey()
            {
                AnswerNo = 1, ParticipantNo = 1
            });
            return(page);
        }
Exemple #3
0
 public CompetitionPageOps()
 {
     page = new CompetitionPage();
     PageFactory.InitElements(SeleniumHelper.Browser.WebDriver, page);
 }