Exemplo n.º 1
0
        public void SetToCacheAndGetFromCache_Pizza_Test()
        {
            var cachingService = new CachingService();
            var pizza          = new Pizza()
            {
                Title = "Pepperoni"
            };

            cachingService.SetToCache("PepperoniPizza", pizza);
            var pizzaFromCache = cachingService.GetFromCache <Pizza>("PepperoniPizza");

            Assert.AreEqual(pizza.Title, pizzaFromCache.Title);
        }
Exemplo n.º 2
0
        public void SetToCacheAndGetFromCache_Null_Test()
        {
            var cachingService = new CachingService();
            var pizza          = new Pizza()
            {
                Title = "Pepperoni"
            };

            cachingService.SetToCache("PepperoniPizza", pizza);

            Thread.Sleep(1000);

            var pizzaFromCache = cachingService.GetFromCache <Pizza>("PepperoniPizza");

            Assert.IsNull(pizzaFromCache);
        }