Beispiel #1
0
        public void ClickingAlreadyShownSymbolDisplaysNewsArticlesCorrespondingly()
        {
            //get handle of the Position Table
            ListView    list = Window.Get <ListView>(TestDataInfrastructure.GetControlId("PositionTableId"));
            string      symbol;
            List <News> news;
            ListBox     articlesView;

            //click the particular symbol of the Position table STOCK0
            ListViewRow symbolRow = list.Rows.Find(row => row.Cells[TestDataInfrastructure.GetTestInputData("PositionTableSymbol")].Text.Equals(TestDataInfrastructure.GetTestInputData("Symbol")));

            symbolRow.Click();

            //click on the position symbol STOCK6
            ListViewRow secondSymbolRow = list.Rows.Find(row => row.Cells[TestDataInfrastructure.GetTestInputData("PositionTableSymbol")].Text.Equals(TestDataInfrastructure.GetTestInputData("PositionSymbol")));

            secondSymbolRow.Click();

            //click the particular symbol of the Position table STOCK0
            symbolRow.Click();

            //Get the news item for a particular symbol
            symbol = TestDataInfrastructure.GetTestInputData("Symbol");
            news   = TestDataInfrastructure.GetDataForId <NewsDataProvider, News>(symbol);

            //Get the handler of the News Article View displayed
            articlesView = Window.Get <ListBox>(TestDataInfrastructure.GetControlId("NewsArticlesView"));

            Assert.AreEqual(news.Count, articlesView.Items.Count);
        }
Beispiel #2
0
        public void DisplayedNewsDoubleClick()
        {
            //Get the handle of the Position table
            ListView list = Window.Get <ListView>(TestDataInfrastructure.GetControlId("PositionTableId"));

            //Click on the particular symbol row
            list.Rows.Find(row => row.Cells[TestDataInfrastructure.GetTestInputData("PositionTableSymbol")].Text.Equals(TestDataInfrastructure.GetTestInputData("Symbol"))).Click();

            //Get the news item for the particular symbol row
            List <News> news = TestDataInfrastructure.GetDataForId <NewsDataProvider, News>(TestDataInfrastructure.GetTestInputData("Symbol"));

            //Get the handle of the articles view
            ListBox articlesView = Window.Get <ListBox>(TestDataInfrastructure.GetControlId("NewsArticlesView"));

            //Double click the first news article item
            articlesView.Items[0].DoubleClick();

            //Get the handle of the News Reader window
            Window newsWindow = App.GetWindows().Find(newsArticleWindow => newsArticleWindow.Title.Equals("News Reader"));

            Assert.IsNotNull(newsWindow);

            //Geth the Body,Title and Published Date from the News Reader window
            string   body          = newsWindow.Get <TextBox>(TestDataInfrastructure.GetControlId("ArticleBody")).Text;
            string   title         = newsWindow.Get <Label>(TestDataInfrastructure.GetControlId("ArticleTitle")).Text;
            DateTime publishedDate = Convert.ToDateTime(newsWindow.Get <Label>(TestDataInfrastructure.GetControlId("ArticlePublishedDate")).Text, CultureInfo.CurrentCulture);

            Assert.AreEqual(body, news[0].Body);
            Assert.AreEqual(title, news[0].Title);
            Assert.AreEqual(publishedDate, news[0].PublishedDate);
        }
Beispiel #3
0
        public void SelectedSymbolRepeatedPositionRowClick()
        {
            //get handle of the Position Table
            ListView    list = Window.Get <ListView>(TestDataInfrastructure.GetControlId("PositionTableId"));
            string      symbol;
            List <News> news;
            ListBox     articlesView;

            //click the particular symbol of the Position table
            ListViewRow symbolRow = list.Rows.Find(row => row.Cells[TestDataInfrastructure.GetTestInputData("PositionTableSymbol")].Text.Equals(TestDataInfrastructure.GetTestInputData("Symbol")));

            symbolRow.Click();

            //Get the news item for a particular symbol
            symbol = TestDataInfrastructure.GetTestInputData("Symbol");
            news   = TestDataInfrastructure.GetDataForId <NewsDataProvider, News>(symbol);

            //Get the handler of the News Article View displayed
            articlesView = Window.Get <ListBox>(TestDataInfrastructure.GetControlId("NewsArticlesView"));

            //Get the number of news items for the particular symbol
            int newsCount = news.Count;

            Assert.AreEqual(newsCount, articlesView.Items.Count);

            //click the particular symbol of the Position table
            symbolRow.Click();

            //Get the handler of the News Article View displayed
            articlesView = Window.Get <ListBox>(TestDataInfrastructure.GetControlId("NewsArticlesView"));

            Assert.AreEqual(newsCount, articlesView.Items.Count);
        }
Beispiel #4
0
        public void SelectedSymbolNewsDisplay()
        {
            //get handle of the Position Table and click on each of the rows one after the other
            ListView    list = Window.Get <ListView>(TestDataInfrastructure.GetControlId("PositionTableId"));
            string      symbol;
            List <News> news;
            ListBox     articlesView;
            Label       articleTitle;
            Label       articlePublishedDate;

            foreach (ListViewRow symbolRow in list.Rows)
            {
                symbolRow.Click();
                symbol = symbolRow.Cells[TestDataInfrastructure.GetTestInputData("PositionTableSymbol")].Text;

                news         = TestDataInfrastructure.GetDataForId <NewsDataProvider, News>(symbol);
                articlesView = Window.Get <ListBox>(TestDataInfrastructure.GetControlId("NewsArticlesView"));

                if (null != news)
                {
                    Assert.AreEqual <int>(news.Count, articlesView.Items.Count);
                }
                else
                {
                    Assert.AreEqual <int>(0, articlesView.Items.Count);
                }

                foreach (News newsItem in news)
                {
                    articleTitle = (Label)Window.Get(SearchCriteria.ByAutomationId(TestDataInfrastructure.GetControlId("ArticleTitle"))
                                                     .AndByText(newsItem.Title)
                                                     .AndControlType(typeof(Label)));

                    Assert.IsNotNull(articleTitle);

                    articlePublishedDate = (Label)Window.Get(SearchCriteria.ByAutomationId(TestDataInfrastructure.GetControlId("ArticlePublishedDate"))
                                                             .AndByText(newsItem.PublishedDate.ToString())
                                                             .AndControlType(typeof(Label)));

                    Assert.IsNotNull(articlePublishedDate);
                }
            }
        }