Exemple #1
0
        public void CalculateGBCEAllShareIndexZeroTest()
        {
            var           stocks       = new List <Stock>();
            StocksService stockService = new StocksService(stocks);
            const int     expected     = 0;
            var           actual       = stockService.CalculateGBCEAllShareIndex();

            Assert.AreEqual(expected, actual);
        }
Exemple #2
0
        public void CalculateGBCEAllShareIndexTest()
        {
            var           stocks         = TestData.GetStocksForGeometricMeanCalculations();
            StocksService stockService   = new StocksService(stocks);
            const int     marketPriceOne = 100;
            const int     marketPriceTwo = 200;

            double expectedValue = marketPriceOne * marketPriceTwo;

            expectedValue = Math.Pow(expectedValue, 1.0 / 2);

            var actualValue = stockService.CalculateGBCEAllShareIndex();

            Assert.AreEqual(expectedValue, actualValue);
        }