Example #1
0
        public void CalculateAverageWaitTimeTestDivisionByZero()
        {
            //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 = 0;

            //perform action.
            target.CalculateAverageWaitTime();
            double result = target.AverageWaitTime;

            //check results.
            Assert.AreEqual(expected, result);
        }
Example #2
0
        public void CalculateAverageWaitTimeTestPerformCalculation()
        {
            //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 = 3;

            //add time waiting samples
            target.TakeWaitTimeSample(1);
            target.TakeWaitTimeSample(2);
            target.TakeWaitTimeSample(3);
            target.TakeWaitTimeSample(4);
            target.TakeWaitTimeSample(5);

            //perform action.
            target.CalculateAverageWaitTime();
            double result = target.AverageWaitTime;

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