public void CalculateAverageSystemTimeTestDivisionByZero() { //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.CalculateAverageSystemTime(); double result = target.AverageSystemTime; //check results. Assert.AreEqual(expected, result); }
public void CalculateAverageSystemTimeTestPerformCalculation() { //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 = 9; //add system time samples target.TakeSystemTimeSample(3); target.TakeSystemTimeSample(6); target.TakeSystemTimeSample(9); target.TakeSystemTimeSample(12); target.TakeSystemTimeSample(15); //perform action. target.CalculateAverageSystemTime(); double result = target.AverageSystemTime; //check results. Assert.AreEqual(expected, result); }