예제 #1
0
        public void Test_GetPortfolioPercentChangeInValueForMonth_Simple()
        {
            // provjera izračuna postotka mjesečne promjene

            string dionica1 = "Dionica1";

            _stockExchange.ListStock(dionica1, 1000, 100m, new DateTime(2014, 1, 1, 0, 0, 0, 0));      // 1.1.2014. 0:00 100kn

            _stockExchange.SetStockPrice(dionica1, new DateTime(2014, 1, 31, 0, 0, 0, 0), 150);        // 15.1.2014. 0:00 150kn (+50%)

            string portfolio1 = "portfolio1";

            _stockExchange.CreatePortfolio(portfolio1);

            _stockExchange.AddStockToPortfolio(portfolio1, dionica1, 100);

            Assert.AreEqual(50, _stockExchange.GetPortfolioPercentChangeInValueForMonth(portfolio1, 2014, 1));  // 1. mjesec 2014.
        }