public void Should_Add_Entity_CacheRepository()
        {
            var cache = new DictionaryCacheRepository(new WorkBenchContext());

            cache.Add(
                new Dictionary
            {
                Code            = 100,
                CompanyId       = 1,
                CreatedBy       = 1,
                DateAdded       = DateTime.Now,
                DateUpdated     = DateTime.Now,
                DepartmentId    = 1,
                Description     = "",
                DictionaryType  = "updated",
                FullDescription = "updated",
                Hierarchy       = 1,
                Id2             = 1,
                Id3             = 1,
                UpdatedBy       = 1,
                IsDeleted       = false
            });
            cache.Save();

            Assert.That(cache.GetSingle(x => x.Code == 100), Is.Not.Null);
        }
        public void Should_Invalidate_on_Remove_CacheRepository()
        {
            var cache      = new DictionaryCacheRepository(new WorkBenchContext());
            var dictionary = new Dictionary()
            {
                Code = 100
            };

            cache.Remove(dictionary);
            cache.Save();

            Assert.False(cache.GetAll().Contains(dictionary));
        }
        public void Should_Update_Entity_CacheRepository()
        {
            var cache = new DictionaryCacheRepository(new WorkBenchContext());
            var item  = cache.GetSingle(x => x.Code == 100);

            Assert.That(item, Is.Not.Null);

            item.Description = "updated";
            cache.Update(item);
            cache.Save();

            Assert.That(cache.GetSingle(x => x.Code == 100).Description, Is.EqualTo("updated"));
        }