public void CustomerManager_GetCustomerById_InProcessorCacheTest()
        {
            var cache           = new InProcessorCache.Cache <IEnumerable <Customer> >();
            var customerManager = new CustomersManager(cache);

            long executionTimeWithoutCaching = 0;
            long executionTimeWithCaching    = 0;

            var id = "BOLID";

            _stopwatch.Start();

            var inProcessorCacheResult1 = customerManager.GetCustomerById(id);

            _stopwatch.Stop();

            executionTimeWithoutCaching = _stopwatch.ElapsedMilliseconds;

            _stopwatch.Restart();

            var inProcessorCacheResult2 = customerManager.GetCustomerById(id);

            _stopwatch.Stop();

            executionTimeWithCaching = _stopwatch.ElapsedMilliseconds;

            Assert.IsTrue(executionTimeWithoutCaching > executionTimeWithCaching);
        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            var customerManager = new CustomersManager();

            Console.WriteLine(customerManager.GetCustomerById("NS-77777"));

            Console.WriteLine("==========================");

            //List<Customer> customers = customerManager.GetAllCustomers().ToList();
            //customers.ForEach(Console.WriteLine);

            //Console.WriteLine("==========================");

            //customerManager.InsertCustomer("Test-ID2", "Axel", "Stone", 2, "Los Angeles");

            customerManager.DeleteCustomerById("Test-ID");

            List <Customer> customers = customerManager.GetAllCustomers().ToList();

            customers.ForEach(Console.WriteLine);
        }