Example #1
0
        public void BuyTradeRecordTest()
        {
            var stockCommon = new CommonStock {
                symbol = "POP", lastDividend = 8, parValue = 100
            };

            exchangeStock.AddStock(stockCommon);
            exchangeStock.BuyStock(stockCommon.symbol, 10, 3);
            exchangeStock.SellStock(stockCommon.symbol, 5, 5);
            exchangeStock.BuyStock(stockCommon.symbol, 5, 2);

            var currentBuyTrades  = exchangeStock.tradeList.Where(trade => trade.direction.Equals(TradeDirection.BUY)).ToList().Count;
            var expectedBuyTrades = 2;

            Assert.AreEqual(expectedBuyTrades, currentBuyTrades);
        }