public void CalculateRepUtiliziationTestPerformCalculation() { //initialize a product type. string[] productTypes = new string[] { ProductData.CAR_STEREO_PRODUCT }; //initialize a service desk. ServiceDesk sd = new ServiceDesk(productTypes[0], 1, 0, null); //initialze the service desk representative work time (30 minutes in seconds) sd.AddEntity(null, 1800); //initialize a statistic handler. StatisticsHandler_Accessor target = new StatisticsHandler_Accessor(0, productTypes); //initialize the total work time (in minutes) target.ObserveTime = 60; //intialize the expected result (the service rep should have worked //for 50% of the available time). double expected = 0.5; //perform action target.CalculateRepUtiliziation(sd); double result = target.RepUtilization[productTypes[0]]; //check results Assert.AreEqual(expected, result); }
public void CalculateRepUtiliziationTestDivisionByZero() { //initialize a product type. string[] productTypes = new string[] { ProductData.CAR_STEREO_PRODUCT }; //initialize a service desk. ServiceDesk sd = new ServiceDesk(productTypes[0], 1, 0, null); //initialize a statistic handler. StatisticsHandler_Accessor target = new StatisticsHandler_Accessor(0, productTypes); //intialize the expected result. double expected = double.NaN; //perform atcion target.CalculateRepUtiliziation(sd); double result = target.RepUtilization[productTypes[0]]; //check results Assert.AreEqual(expected, result); }