public void GivenMarketPriceIsZeroCalculateDividendYieldForCommonStockReturnNull()
        {
            var          stock        = TestData.GetTestCommonStock();
            var          stockManager = new StockService();
            const double marketPrice  = 0.0;
            double?      expected     = null;
            var          actual       = stockManager.CalculateDividendYield(stock, marketPrice);

            Assert.AreEqual(expected, actual);
        }
        public void GivenMarketPriceCalculateDividendYieldForCommonStock()
        {
            var          stock        = TestData.GetTestCommonStock();
            var          stockManager = new StockService();
            const double marketPrice  = 100;
            const double lastDividend = 2;

            const double expectedValue = lastDividend / marketPrice;
            var          actualValue   = stockManager.CalculateDividendYield(stock, marketPrice);

            Assert.AreEqual(expectedValue, actualValue);
        }
        public void GivenMarketPriceCalculateDividendYieldForPreferredStock()
        {
            var stockManager = new StockService();

            var          stock         = TestData.GetTestPreferredStock();
            const double marketPrice   = 821;
            const double fixedDividend = 0.03;
            const double parValue      = 100;

            const double expectedValue = (fixedDividend * parValue) / marketPrice;

            var actualValue = stockManager.CalculateDividendYield(stock, marketPrice);

            Assert.AreEqual(expectedValue, actualValue);
        }