public void CustomerManager_GetCustomersByRegion_InProcessorCacheTest() { var cache = new InProcessorCache.Cache <IEnumerable <Customer> >(); var customerManager = new CustomersManager(cache); long executionTimeWithoutCaching = 0; long executionTimeWithCaching = 0; var region = "RJ"; _stopwatch.Start(); var inProcessorCacheResult1 = customerManager.GetCustomersByRegion(region); _stopwatch.Stop(); executionTimeWithoutCaching = _stopwatch.ElapsedMilliseconds; _stopwatch.Restart(); var inProcessorCacheResult2 = customerManager.GetCustomersByRegion(region); _stopwatch.Stop(); executionTimeWithCaching = _stopwatch.ElapsedMilliseconds; Assert.IsTrue(executionTimeWithoutCaching > executionTimeWithCaching); }
public void CustomerManager_GetOrderByCustomerId_InProcessorCacheTest() { var cache = new InProcessorCache.Cache <IEnumerable <Order> >(); var ordersManager = new OrdersManager(cache); long executionTimeWithoutCaching = 0; long executionTimeWithCaching = 0; var customerId = "THEBI"; _stopwatch.Start(); var inProcessorCacheResult1 = ordersManager.GetOrderByCustomerId(customerId); _stopwatch.Stop(); executionTimeWithoutCaching = _stopwatch.ElapsedMilliseconds; _stopwatch.Restart(); var inProcessorCacheResult2 = ordersManager.GetOrderByCustomerId(customerId); _stopwatch.Stop(); executionTimeWithCaching = _stopwatch.ElapsedMilliseconds; Assert.IsTrue(executionTimeWithoutCaching > executionTimeWithCaching); }