public void EditSubscribeTest()
        {
            //ARRANGE
            RepositoryEditItem <ObjectMappingForTest, EditParamOfCRUDOperation <ObjectMappingForTest> > repositoryItem = new RepositoryEditItem <ObjectMappingForTest, EditParamOfCRUDOperation <ObjectMappingForTest> >(_uow, context);

            MemoryCacheRepository <ObjectMappingForTest> cacheTestClass = new MemoryCacheRepository <ObjectMappingForTest>();
            HandlerCRUD <ObjectMappingForTest, EditParamOfCRUDOperation <ObjectMappingForTest> > processingObjectTestCalss = new HandlerCRUD <ObjectMappingForTest, EditParamOfCRUDOperation <ObjectMappingForTest> >(repositoryItem);
            FetchDomainData <ObjectMappingForTest> fetchDomainDataTestClass = new FetchDomainData <ObjectMappingForTest>(_uow);

            //ACT
            CacheCRUDBLLDecorator <ObjectMappingForTest, EditParamOfCRUDOperation <ObjectMappingForTest> > processingObjectCacheDecorator = new EditCacheCRUDBLLDecorator <ObjectMappingForTest>(processingObjectTestCalss, cacheTestClass);
            var resultSave = processingObjectCacheDecorator.Execute(new EditParamOfCRUDOperation <ObjectMappingForTest>()
            {
                Item = new ObjectMappingForTest()
                {
                    Id = 1, IntValue = 22, IntValue2 = 33
                }
            }).Result;


            ObjectMappingForTest resultFromCache = cacheTestClass.GetByIdAsync(1).Result;
            ObjectMappingForTest resultFromDB    = fetchDomainDataTestClass.GetByIdAsync(1).Result;


            //ASSERT
            Assert.IsNotNull(resultFromCache);                                //В кеше есть данные

            Assert.AreEqual(resultFromDB.IntValue, resultFromCache.IntValue); //Проверка, что данные добавленные одинаковые
            Assert.AreEqual(resultFromDB.IntValue2, resultFromCache.IntValue2);
            Assert.AreEqual(33, resultFromDB.IntValue2);
        }
        public void DeleteInCacheAndDataBaseTest()
        {
            //ARRANGE
            RepositoryAddItem <ObjectMappingForTest, AddParamOfCRUDOperation <ObjectMappingForTest> >       repositoryAddItem    = new RepositoryAddItem <ObjectMappingForTest, AddParamOfCRUDOperation <ObjectMappingForTest> >(_uow, context);
            RepositoryDeleteItem <ObjectMappingForTest, DeleteParamOfCRUDOperation <ObjectMappingForTest> > repositoryDeleteItem = new RepositoryDeleteItem <ObjectMappingForTest, DeleteParamOfCRUDOperation <ObjectMappingForTest> >(_uow, context);

            MemoryCacheRepository <ObjectMappingForTest> cacheTestClass = new MemoryCacheRepository <ObjectMappingForTest>();
            HandlerCRUD <ObjectMappingForTest, AddParamOfCRUDOperation <ObjectMappingForTest> >    processingObjectTestCalss       = new HandlerCRUD <ObjectMappingForTest, AddParamOfCRUDOperation <ObjectMappingForTest> >(repositoryAddItem);
            HandlerCRUD <ObjectMappingForTest, DeleteParamOfCRUDOperation <ObjectMappingForTest> > processingDeleteObjectTestClass = new HandlerCRUD <ObjectMappingForTest, DeleteParamOfCRUDOperation <ObjectMappingForTest> >(repositoryDeleteItem);
            FetchDomainData <ObjectMappingForTest> fetchDomainDataTestClass = new FetchDomainData <ObjectMappingForTest>(_uow);

            //ACT
            CacheCRUDBLLDecorator <ObjectMappingForTest, AddParamOfCRUDOperation <ObjectMappingForTest> >    processingObjectCacheDecorator       = new AddCacheCRUDBLLDecorator <ObjectMappingForTest>(processingObjectTestCalss, cacheTestClass);
            CacheCRUDBLLDecorator <ObjectMappingForTest, DeleteParamOfCRUDOperation <ObjectMappingForTest> > processingDeleteObjectCacheDecorator = new DeleteCacheCRUDBLLDecorator <ObjectMappingForTest>(processingDeleteObjectTestClass, cacheTestClass);

            var resultSave = processingObjectCacheDecorator.Execute(new AddParamOfCRUDOperation <ObjectMappingForTest>()
            {
                Item = new ObjectMappingForTest()
                {
                    IntValue = 2222, IntValue2 = 3333
                }
            }).Result;


            ObjectMappingForTest resultFromCache = cacheTestClass.GetByIdAsync(2).Result;
            ObjectMappingForTest resultFromDB    = fetchDomainDataTestClass.GetByIdAsync(2).Result;

            //ASSERT
            Assert.IsNotNull(resultFromCache);                                //В кеше есть данные

            Assert.AreEqual(resultFromDB.IntValue, resultFromCache.IntValue); //Проверка, что данные добавленные одинаковые
            Assert.AreEqual(resultFromDB.IntValue2, resultFromCache.IntValue2);
            Assert.AreEqual(3333, resultFromDB.IntValue2);



            //ACT - Удаляем данные
            resultSave = processingDeleteObjectCacheDecorator.Execute(new DeleteParamOfCRUDOperation <ObjectMappingForTest>()
            {
                Item = new ObjectMappingForTest()
                {
                    Id = 2
                }
            }).Result;
            resultFromCache = cacheTestClass.GetByIdAsync(3).Result;
            var exArgumentException = Assert.ThrowsExceptionAsync <ArgumentException>(() => fetchDomainDataTestClass.GetByIdAsync(3));

            //ASSERT
            Assert.IsNull(resultFromCache);//В кеше есть данные
        }
        public void GetByIdTest()
        {
            CreateContext();
            FetchDomainData <ObjectMappingForTest> bll = new FetchDomainData <ObjectMappingForTest>(_uow);

            var ex = Assert.ThrowsExceptionAsync <ArgumentException>(() => bll.GetByIdAsync(10), "Запись не найдена.");

            //Проверка успешного получения записи

            ObjectMappingForTest resultGetById = bll.GetByIdAsync(1).Result;

            Assert.IsNotNull(resultGetById);
            Assert.AreEqual(1, resultGetById.Id);
            Assert.AreEqual(2, resultGetById.IntValue);
            Assert.AreEqual("2", resultGetById.StrValue);
        }
        public void CheckWorkWithCacheTest()
        {
            //ARRANGE
            RepositoryAddItem <ObjectMappingForTest, AddParamOfCRUDOperation <ObjectMappingForTest> > repositoryAddItem = new RepositoryAddItem <ObjectMappingForTest, AddParamOfCRUDOperation <ObjectMappingForTest> >(_uow, context);

            MemoryCacheRepository <ObjectMappingForTest> cacheTestClass = new MemoryCacheRepository <ObjectMappingForTest>();
            HandlerCRUD <ObjectMappingForTest, AddParamOfCRUDOperation <ObjectMappingForTest> > processingObjectTestCalss = new HandlerCRUD <ObjectMappingForTest, AddParamOfCRUDOperation <ObjectMappingForTest> >(repositoryAddItem);
            FetchDomainData <ObjectMappingForTest> fetchDomainDataTestClass = new FetchDomainData <ObjectMappingForTest>(_uow);


            //ACT
            CacheCRUDBLLDecorator <ObjectMappingForTest, AddParamOfCRUDOperation <ObjectMappingForTest> > processingObjectCacheDecorator = new AddCacheCRUDBLLDecorator <ObjectMappingForTest>(processingObjectTestCalss, cacheTestClass);
            ObjectMappingForTest resultFromCache = cacheTestClass.GetByIdAsync(1).Result;
            ObjectMappingForTest resultFromDB    = fetchDomainDataTestClass.GetByIdAsync(1).Result;


            //ASSERT
            Assert.IsNull(resultFromCache); //В "БД" есть запись, но в кеше нет ее;

            Assert.IsNotNull(resultFromDB); //В "БД" есть запись
        }