public void SellMultipleStocksFromPositionTableByClickingSubmitAll()
        {
            string symbol;
            string anotherSymbol;

            symbol        = TestDataInfrastructure.GetTestInputData("Symbol");
            anotherSymbol = TestDataInfrastructure.GetTestInputData("PositionSymbol");

            /////////////////////////////////
            //Enter Share 1 Details
            LaunchBuySellPanelFromPositionTable(BuySellEnum.Sell, symbol);
            Order model = new Order(
                symbol,
                Decimal.Parse(TestDataInfrastructure.GetTestInputData("BuySellLimitPrice"), CultureInfo.InvariantCulture),
                TestDataInfrastructure.GetTestInputData("BuySellOrderType"),
                int.Parse(TestDataInfrastructure.GetTestInputData("BuySellNumberOfShares"), CultureInfo.InvariantCulture),
                TestDataInfrastructure.GetTestInputData("TimeInForceEndOfDay"),
                BuySellEnum.Sell.ToString()
                );

            PopulateBuySellPanelWithData(model);
            /////////////////////////////////

            /////////////////////////////////
            //Enter Share 2 Details
            LaunchBuySellPanelFromPositionTable(BuySellEnum.Sell, anotherSymbol);
            Order anotherModel = new Order(
                anotherSymbol,
                Decimal.Parse(TestDataInfrastructure.GetTestInputData("BuySellLimitPrice"), CultureInfo.InvariantCulture),
                TestDataInfrastructure.GetTestInputData("BuySellOrderType"),
                int.Parse(TestDataInfrastructure.GetTestInputData("BuySellNumberOfShares"), CultureInfo.InvariantCulture),
                TestDataInfrastructure.GetTestInputData("TimeInForceEndOfDay"),
                BuySellEnum.Sell.ToString()
                );

            PopulateBuySellPanelWithData(anotherModel);

            Button submitAllButton = Window.Get <Button>(TestDataInfrastructure.GetControlId("BuySellSubmitAllButton"));

            submitAllButton.Click();

            //give time for submit processing
            System.Threading.Thread.Sleep(2000);

            // Validate if expander Buy/Sell Panels disappear.
            // AND
            // Validate if the sell transactions were successful
            GroupBox buySellSymbolGroup = Window.Get <GroupBox>(SearchCriteria.ByAutomationId("CompositeExpander")
                                                                .AndControlType(typeof(GroupBox)));

            Assert.IsNull(buySellSymbolGroup);

            List <Order> orders = TestDataInfrastructure.GetData <OrderDataProvider, Order>();

            Assert.IsNotNull(orders.Find(o => o.Symbol.Equals(symbol) || o.Symbol.Equals(anotherSymbol)));

            // Validate the correctness of data.
            Assert.IsTrue(orders.Find(o => o.Symbol.Equals(symbol)).Equals(model));
            Assert.IsTrue(orders.Find(o => o.Symbol.Equals(anotherSymbol)).Equals(anotherModel));
        }
Exemplo n.º 2
0
        public void ValidateDefaultCompositeTrendView()
        {
            // Data Assumptions :
            // Trend data composite is calculated based on all the data - hence they all need the same time span and data sampling
            // We should have some BVT test that validates the test and Sample data ARE OK with our assumption
            // - Validate our Data Set!

            // Get the PositionTable
            // Get ahold of the following trendlineView data
            //    - Get the Title, Validate the default it should be "FAKEINDEX"
            //    - Caluculate the composite data set
            //    - Get the Min Max on the Y axis
            //    - Validate that the test calculated data is bounded by the Y Data range displayed in the view
            //    - Validate the data range and Get the Min Max date value in our Test time span match the displayed time span
            //

            // Loop the the rows
            //  - Select the first row
            //    need to force an invoke
            //

            Assert.IsNotNull(Window.AutomationElement.SearchInRawTreeByName(TestDataInfrastructure.GetTestInputData("DefaultCompositeTrendView")));

            List <MarketHistoryItem> history      = TestDataInfrastructure.GetData <MarketHistoryDataProvider, MarketHistoryItem>();
            List <MarketHistoryItem> defaultItems = history.FindAll(i => i.TickerSymbol.Equals(TestDataInfrastructure.GetTestInputData("DefaultCompositeTrendView")));

            Assert.IsTrue(ValidateXAxisDataRange(defaultItems));
            Assert.IsTrue(ValidateYAxisDataRange(defaultItems));
        }
        public void SellStockFromPositionTableByClickingSellAtLast()
        {
            string symbol;

            symbol = TestDataInfrastructure.GetTestInputData("Symbol");
            LaunchBuySellPanelFromPositionTable(BuySellEnum.Sell, symbol);
            Order model = new Order(
                symbol,
                Decimal.Parse(TestDataInfrastructure.GetTestInputData("BuySellLimitPrice"), CultureInfo.InvariantCulture),
                TestDataInfrastructure.GetTestInputData("BuySellOrderType"),
                int.Parse(TestDataInfrastructure.GetTestInputData("BuySellNumberOfShares"), CultureInfo.InvariantCulture),
                TestDataInfrastructure.GetTestInputData("BuySellTfimeInForce"),
                BuySellEnum.Sell.ToString()
                );

            PopulateBuySellPanelWithData(model);

            Button sellAtLastButton = Window.Get <Button>(TestDataInfrastructure.GetControlId("BuySellSellLastButton"));

            sellAtLastButton.Click();

            //get the last price for the share
            List <Market> market = TestDataInfrastructure.GetData <MarketDataProvider, Market>();

            model.LimitStopPrice = market.Find(m => m.TickerSymbol.Equals(symbol)).LastPrice;

            Button submitButton = Window.Get <Button>(TestDataInfrastructure.GetControlId("BuySellSubmitButton"));

            submitButton.Click();

            //give time for submit processing
            System.Threading.Thread.Sleep(2000);

            // Validate if the tab disappears.
            Tab buySellSymbolTab = Window.Get <Tab>(
                SearchCriteria.ByText(BuySellEnum.Sell.ToString() + " " + symbol).AndControlType(typeof(Tab)));

            Assert.IsNull(buySellSymbolTab);

            //validate if the buy transaction was successful
            List <Order> orders = TestDataInfrastructure.GetData <OrderDataProvider, Order>();

            Assert.IsTrue(orders.Find(o => o.Symbol.Equals(symbol)).Equals(model));
        }
Exemplo n.º 4
0
        public void AddSpecialCharactersSymbolToWatchList()
        {
            ListView watchList = Window.Get <ListView>(TestDataInfrastructure.GetControlId("WatchListView"));
            int      watchListCountBeforeClick = watchList.Rows.Count;

            TextBox addWatchTextBox = Window.Get <TextBox>(TestDataInfrastructure.GetControlId("WatchListAddTextBox"));

            addWatchTextBox.Text = TestDataInfrastructure.GetTestInputData("SpecialCharacterSymbol");

            Button addWatchListButton = Window.Get <Button>(TestDataInfrastructure.GetControlId("WatchListAddButton"));

            addWatchListButton.Click();

            List <AccountPosition> position = TestDataInfrastructure.GetData <AccountPositionDataProvider, AccountPosition>();

            Assert.IsNull(position.Find(ap => ap.TickerSymbol.Equals(addWatchTextBox.Text)));

            Assert.AreEqual(watchListCountBeforeClick, watchList.Rows.Count);
            //also check if the special characters symbol does not appear in the Watchlist window
            Assert.IsNull(watchList.Rows.Find(r => r.Cells[0].Text == addWatchTextBox.Text));
        }
Exemplo n.º 5
0
        public void AddSymbolWithTrailingBlankSpacesToWatchList()
        {
            ListView watchList = Window.Get <ListView>(TestDataInfrastructure.GetControlId("WatchListView"));
            int      watchListCountBeforeClick = watchList.Rows.Count;

            TextBox addWatchTextBox = Window.Get <TextBox>(TestDataInfrastructure.GetControlId("WatchListAddTextBox"));

            addWatchTextBox.Text = TestDataInfrastructure.GetTestInputData("TrailingBlankSpacePositionSymbol");

            Button addWatchListButton = Window.Get <Button>(TestDataInfrastructure.GetControlId("WatchListAddButton"));

            addWatchListButton.Click();

            List <AccountPosition> position = TestDataInfrastructure.GetData <AccountPositionDataProvider, AccountPosition>();

            Assert.IsNotNull(position.Find(ap => ap.TickerSymbol.Equals(addWatchTextBox.Text.TrimEnd())));

            Assert.AreEqual(watchListCountBeforeClick + 1, watchList.Rows.Count);
            //also check if the symbol with Trailing Blank Space does not appear in the Watchlist window
            Assert.IsNotNull(watchList.Rows.Find(r => r.Cells[0].Text == addWatchTextBox.Text.TrimEnd()));
        }
Exemplo n.º 6
0
        public void ValidateMarketTrendDataPerSelectedPositionRow()
        {
            // Data Assumptions :
            // Trend data composite is calculated based on all the data - hence they all need the same time span and data sampling
            // We should have some BVT test that validates the test and Sample data ARE OK with our assumption
            // - Validate our Data Set!

            // Get the PositionTable
            // Will loop through the PositionTable and select each row and validate that Market Trend data is updated
            // Loop
            //    - Get ahold of the  trendlineView data for that row
            //    - Get the Title, Validate the default it should be "XXX" : the stock symbol what ever it is
            //    - Get the data set
            //    - Get the Min Max on the Y axis
            //    - Validate that the test data setis bounded by the Y Data range displayed in the view
            //    - Validate the data range and Get the Min Max date value in our Test time span match the displayed time span
            //

            ListView list = Window.Get <ListView>(TestDataInfrastructure.GetControlId("PositionTableId"));
            string   selectedSymbol;
            List <MarketHistoryItem> history = TestDataInfrastructure.GetData <MarketHistoryDataProvider, MarketHistoryItem>();

            foreach (ListViewRow row in list.Rows)
            {
                row.Click();

                //give time for the graph to be redrawn for the selected symbol
                System.Threading.Thread.Sleep(2000);

                selectedSymbol = row.Cells[0].Text;

                Assert.IsNotNull(Window.AutomationElement.SearchInRawTreeByName(selectedSymbol));

                List <MarketHistoryItem> defaultItems = history.FindAll(i => i.TickerSymbol.Equals(selectedSymbol));

                Assert.IsTrue(ValidateXAxisDataRange(defaultItems));
                Assert.IsTrue(ValidateYAxisDataRange(defaultItems));
            }
        }
        public void BuyStockFromPositionTableByClickingSubmit()
        {
            string symbol;

            symbol = TestDataInfrastructure.GetTestInputData("Symbol");
            LaunchBuySellPanelFromPositionTable(BuySellEnum.Buy, symbol);

            Order model = new Order(
                symbol,
                Decimal.Parse(TestDataInfrastructure.GetTestInputData("BuySellLimitPrice"), CultureInfo.InvariantCulture),
                TestDataInfrastructure.GetTestInputData("BuySellOrderType"),
                int.Parse(TestDataInfrastructure.GetTestInputData("BuySellNumberOfShares"), CultureInfo.InvariantCulture),
                TestDataInfrastructure.GetTestInputData("TimeInForceEndOfDay"),
                BuySellEnum.Buy.ToString()
                );

            PopulateBuySellPanelWithData(model);

            Button submitButton = Window.Get <Button>(TestDataInfrastructure.GetControlId("BuySellSubmitButton"));

            submitButton.Click();

            //give time for submit processing
            System.Threading.Thread.Sleep(2000);

            // Validate if selected tab in Buy/Sell Panel disappears.
            // AND
            // Validate if the buy transactions were successful
            GroupBox buySellSymbolGroup = Window.Get <GroupBox>(SearchCriteria.ByAutomationId("CompositeExpander")
                                                                .AndControlType(typeof(GroupBox)));

            Assert.IsNull(buySellSymbolGroup);

            //validate if the buy transaction was successful
            List <Order> orders = TestDataInfrastructure.GetData <OrderDataProvider, Order>();

            Assert.IsTrue(orders.Find(o => o.Symbol.Equals(symbol)).Equals(model));
        }
Exemplo n.º 8
0
        public void WatchListTableContent()
        {
            ListView watchList = Window.Get <ListView>(TestDataInfrastructure.GetControlId("WatchListView"));
            int      watchListCountBeforeClick = watchList.Rows.Count;

            TextBox addWatchTextBox = Window.Get <TextBox>(TestDataInfrastructure.GetControlId("WatchListAddTextBox"));

            addWatchTextBox.Text = TestDataInfrastructure.GetTestInputData("WatchListSymbol");

            Button addWatchListButton = Window.Get <Button>(TestDataInfrastructure.GetControlId("WatchListAddButton"));

            addWatchListButton.Click();

            Assert.AreEqual(watchListCountBeforeClick + 1, watchList.Rows.Count);

            List <Market> market = TestDataInfrastructure.GetData <MarketDataProvider, Market>();

            //check if the added symbol has the correct last price value displayed
            Assert.IsNotNull(watchList.Rows.Find(r =>
                                                 ((r.Cells[0].Text == addWatchTextBox.Text) &&
                                                  (r.Cells[1].Text == market.Find(m => m.TickerSymbol == addWatchTextBox.Text).LastPrice.ToString(CultureInfo.CurrentCulture))
                                                 )));
        }
        public void LaunchBuySellPanelFromPositionTableAndEnterStockBuyDetailsAndClickToolbarCancel()
        {
            string symbol;

            symbol = TestDataInfrastructure.GetTestInputData("Symbol");
            LaunchBuySellPanelFromPositionTable(BuySellEnum.Buy, symbol);
            Order model = new Order(
                symbol,
                Decimal.Parse(TestDataInfrastructure.GetTestInputData("BuySellLimitPrice"), CultureInfo.InvariantCulture),
                TestDataInfrastructure.GetTestInputData("BuySellOrderType"),
                int.Parse(TestDataInfrastructure.GetTestInputData("BuySellNumberOfShares"), CultureInfo.InvariantCulture),
                TestDataInfrastructure.GetTestInputData("TimeInForceEndOfDay"),
                BuySellEnum.Buy.ToString()
                );

            PopulateBuySellPanelWithData(model);

            Button cancelButton = Window.Get <Button>(TestDataInfrastructure.GetControlId("ToolbarCancelButton"));

            cancelButton.Click();

            //give time for cancel processing
            System.Threading.Thread.Sleep(2000);

            // Validate if expander Buy/Sell Panel disappears.
            // AND
            // Validate if the buy transaction did not proceed.
            GroupBox buySellSymbolGroup = Window.Get <GroupBox>(SearchCriteria.ByAutomationId("CompositeExpander")
                                                                .AndControlType(typeof(GroupBox)));

            Assert.IsNull(buySellSymbolGroup);

            List <Order> orders = TestDataInfrastructure.GetData <OrderDataProvider, Order>();

            Assert.IsNull(orders.Find(o => o.Symbol.Equals(symbol)));
        }
Exemplo n.º 10
0
        public void ApplicationLaunch()
        {
            List <Module> lm         = TestDataInfrastructure.GetData <ConfigurationModuleDataProvider, Module>();
            List <Module> sortedList = lm.SortModulesInLoadOrder();

            Label moduleContent;

            foreach (Module m in sortedList)
            {
                moduleContent = Window.Get <Label>(
                    SearchCriteria
                    .ByText(TestDataInfrastructure.GetTestInputData(m.ModuleName + TestDataInfrastructure.GetTestInputData("ContentString")))
                    .AndControlType(typeof(Label)));

                if (m.AllowsDelayLoading)
                {
                    Assert.IsNull(moduleContent);
                }
                else
                {
                    Assert.IsNotNull(moduleContent);
                }
            }
        }