public void Test_AddStockToPortfolio_SameStock() { string stockName = "IBM"; _stockExchange.ListStock(stockName, 5, 100m, DateTime.Now); string portfolioID = "P1"; _stockExchange.CreatePortfolio(portfolioID); _stockExchange.AddStockToPortfolio(portfolioID, stockName, 1); _stockExchange.AddStockToPortfolio(portfolioID, stockName, 2); Assert.True(_stockExchange.IsStockPartOfPortfolio(portfolioID, stockName)); Assert.AreEqual(1, _stockExchange.NumberOfStocksInPortfolio(portfolioID)); Assert.AreEqual(3, _stockExchange.NumberOfSharesOfStockInPortfolio(portfolioID, stockName)); }
public void Test_AddStockToPortfolio_GreaterThenNumOfShares() { // Dodaje se ista dionica više puta u portfelj - ukupno više od postojećeg broja string dionica1 = "Dionica1"; _stockExchange.ListStock(dionica1, 100, 10m, DateTime.Now); string portfelj1 = "portfelj1"; _stockExchange.CreatePortfolio(portfelj1); _stockExchange.AddStockToPortfolio(portfelj1, dionica1, 50); _stockExchange.AddStockToPortfolio(portfelj1, dionica1, 150); // previše ih dodamo, treba ih dodati još 50 (ukupno ih mora biti 100) Assert.True(_stockExchange.IsStockPartOfPortfolio(portfelj1, dionica1)); Assert.AreEqual(100, _stockExchange.NumberOfSharesOfStockInPortfolio(portfelj1, dionica1)); }