public void Test_ListStock_Simple() { Assert.AreEqual(0, _stockExchange.NumberOfStocks()); string firstStockName = "IBM"; _stockExchange.ListStock(firstStockName, 1000000, 10m, DateTime.Now); Assert.AreEqual(1, _stockExchange.NumberOfStocks()); Assert.True(_stockExchange.StockExists(firstStockName)); Assert.False(_stockExchange.StockExists("Bezveze")); string secondStockName = "MSFT"; _stockExchange.ListStock(secondStockName, 100000, 15m, DateTime.Now); Assert.AreEqual(2, _stockExchange.NumberOfStocks()); Assert.True(_stockExchange.StockExists(secondStockName)); }
public void Test_AddStockToIndex_Complicated() { // Dodaju se dionice u index, onda se jedna obriše s burze i pokuša se dohvatiti u indeksu string dionica1 = "Dionica1"; _stockExchange.ListStock(dionica1, 1000000, 10m, DateTime.Now); string dionica2 = "Dionica2"; _stockExchange.ListStock(dionica2, 1000000, 10m, DateTime.Now); string indeks1 = "indeks1"; _stockExchange.CreateIndex(indeks1, IndexTypes.WEIGHTED); _stockExchange.AddStockToIndex(indeks1, dionica1); _stockExchange.AddStockToIndex(indeks1, dionica2); Assert.True(_stockExchange.IsStockPartOfIndex(indeks1, dionica1)); Assert.True(_stockExchange.IsStockPartOfIndex(indeks1, dionica2)); Assert.AreEqual(2, _stockExchange.NumberOfStocksInIndex(indeks1)); _stockExchange.DelistStock(dionica1); _stockExchange.RemoveStockFromIndex(indeks1, dionica1); // treba baciti exception }