Example #1
0
        public void Test_StocksCommonYieldException()
        {
            string stock        = "POP";
            double lastDividend = 8;
            double stockPrice   = 25;
            double price        = 0;


            CommonStock testStock = new CommonStock(stock, lastDividend, stockPrice);


            double dividendYield = testStock.DividendYield(price);
        }
Example #2
0
        public void Test_StocksCommonYield()
        {
            string stock        = "POP";
            double lastDividend = 8;
            double stockPrice   = 25;
            double price        = 64;
            double expected     = lastDividend / price;

            CommonStock testStock = new CommonStock(stock, lastDividend, stockPrice);


            double dividendYield = testStock.DividendYield(price);

            Assert.AreEqual(expected, dividendYield);
        }