Пример #1
0
        public void CalculateAverageNumberWaitingTestDivisionByZero()
        {
            //initialize a product type.
            string[] productTypes = new string[] { ProductData.CAR_STEREO_PRODUCT };

            //initialize  a statistic handler.
            StatisticsHandler_Accessor target = new StatisticsHandler_Accessor(0, productTypes);

            //intialize the expected result.
            double expected = double.NaN;

            //perform action.
            target.CalculateAverageNumberWaiting(productTypes[0]);
            double result = target.AverageNumberWaiting[productTypes[0]];

            //check results.
            Assert.AreEqual(expected, result);
        }
Пример #2
0
        public void CalculateAverageNumberWaitingTestPerformCalculation()
        {
            //initialize a product type.
            string[] productTypes = new string[] { ProductData.CAR_STEREO_PRODUCT };
            //initialize  a statistic handler.
            StatisticsHandler_Accessor target = new StatisticsHandler_Accessor(0, productTypes);
            //intialize the expected result.
            double expected = 6;

            //add number waiting samples
            target.TakeNumberWaitingSample(productTypes[0], 2);
            target.TakeNumberWaitingSample(productTypes[0], 4);
            target.TakeNumberWaitingSample(productTypes[0], 6);
            target.TakeNumberWaitingSample(productTypes[0], 8);
            target.TakeNumberWaitingSample(productTypes[0], 10);

            //perform action.
            target.CalculateAverageNumberWaiting(productTypes[0]);
            double result = target.AverageNumberWaiting[productTypes[0]];

            //check results.
            Assert.AreEqual(expected, result);
        }