コード例 #1
0
        public void Test_ExchangeFindStockException()
        {
            string stock         = "GIN";
            double lastDividend  = 8;
            double fixedDividend = 2;
            double parValue      = 100;
            double stockPrice    = 25;

            GBCE exchange = new GBCE();

            exchange.addPreferredStock(stock, lastDividend, fixedDividend, parValue, stockPrice);

            stock = "POP";

            BaseStock selectedStock = exchange.GetStock(stock);
        }
コード例 #2
0
        public void Test_ExchangeFindStock()
        {
            string stock         = "GIN";
            double lastDividend  = 8;
            double fixedDividend = 2;
            double parValue      = 100;
            double stockPrice    = 25;

            GBCE exchange = new GBCE();

            exchange.addPreferredStock(stock, lastDividend, fixedDividend, parValue, stockPrice);

            stock        = "POP";
            lastDividend = 4;
            stockPrice   = 50;

            exchange.addCommonStock(stock, lastDividend, stockPrice);

            Assert.AreEqual(2, exchange.stocks.Count); //Verify there are two stocks in the exchange

            BaseStock selectedStock = exchange.GetStock(stock);

            Assert.AreEqual(50, selectedStock.stockPrice); //Verify it has the correct stock price
        }