Example #1
0
        public void ShouldCorrectlyCreateEquityObject()
        {
            int    quantity = 1;
            double price    = 2.5;
            string name     = "Equity1";

            var stock = StockFactory.GetStock(quantity, price, name, StockType.Equity);

            Assert.AreEqual(typeof(Equity), stock.GetType());
            Assert.AreEqual(quantity, stock.Quantity);
            Assert.AreEqual(price, stock.Price);
            Assert.AreEqual(name, stock.StockName);
        }
        public void AddStock(int quantity, double price, StockType stockType)
        {
            StockList.Add(StockFactory.GetStock(quantity, price, GetNextStockName(stockType), stockType));

            UpdateStockWeight();
        }