コード例 #1
0
        public void buyStocks()
        {
            //Arrange
            double beginningBal = 5000.00;

            Stocks sto = new Stocks();

            //Act
            sto.Buy(beginningBal);
            double actualBal = sto.GetShares;

            // assert
            Assert.AreEqual(actualBal, 5000.00);
        }
コード例 #2
0
        public void EarnStocks()
        {
            //Arrange
            double beginningBal      = 3500.00;
            double transactionAmount = 2000.00;

            Stocks sto = new Stocks();

            //Act
            sto.Buy(beginningBal);
            sto.Earn(transactionAmount);
            double actualBal = sto.GetShares;

            // assert
            Assert.AreEqual(actualBal, 5500.00);
        }
コード例 #3
0
        public void showPortfolio()
        {
            //Arrange
            double stocksBal  = 5500.00;
            double bondsBal   = 3450.00;
            double annuityBal = 820.00;

            Annuity ann  = new Annuity();
            Stocks  sto  = new Stocks();
            Bonds   bond = new Bonds();

            //Act
            ann.Buy(annuityBal);
            sto.Buy(stocksBal);
            bond.Buy(bondsBal);
            double actualBal = ann.GetShares + sto.GetShares + bond.GetShares;

            // assert
            Assert.AreEqual(actualBal, 9770.00);
        }