Exemplo n.º 1
0
        public void RemoveStock()
        {
            // Arrange
            stockMarket = new StockMarket();
            PrepareMockDataToStockMarket();

            // Act
            List <Stock> stocks            = stockMarket.GetStocks();
            Stock        google            = stocks[0];
            Stock        myExpensiveStocks = stocks[1];

            stockMarket.RemoveStock(google);

            // Assert
            Assert.AreEqual(stockMarket.GetStocks()[0], myExpensiveStocks);
        }
Exemplo n.º 2
0
        public void GetStocks()
        {
            // Arrange
            stockMarket = new StockMarket();
            Stock stockTest1 = new Stock(1, "Test", 1);
            Stock stockTest2 = new Stock(2, "Test", 2);
            Stock stockTest3 = new Stock(3, "Test", 3);

            stockMarket.AddStock(stockTest1);
            stockMarket.AddStock(stockTest2);
            stockMarket.AddStock(stockTest3);

            List <Stock> expected = new List <Stock>()
            {
                stockTest1,
                stockTest2,
                stockTest3
            };

            // Act
            List <Stock> actual = stockMarket.GetStocks();

            // Assert
            Assert.AreEqual(actual, expected);
        }
Exemplo n.º 3
0
        public void AddStock()
        {
            // Arrange
            stockMarket = new StockMarket();

            Stock        newStock           = new Stock(1, "MyNewStock", 100);
            List <Stock> stockMarketOutcome = new List <Stock>
            {
                newStock
            };

            // Act
            stockMarket.AddStock(newStock);

            // Assert
            Assert.AreEqual(stockMarket.GetStocks(), stockMarketOutcome);
        }