예제 #1
0
        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
        }