public async Task MerchantProfileRetrievalFromCache_AvailableInCache()
        {
            int id = 191807;
            IOptions <Settings>        appSettings = Substitute.For <IOptions <Settings> >();
            IMerchantProfileRepository mockRepo    = Substitute.For <IMerchantProfileRepository>();

            mockRepo = new MockMerchantRepository();
            IDistributedCache mockCache = FakeCache();

            mockCache = new MockCacheMerchantProfile();
            IMerchantProfileApi merchantProfileApi = new MerchantProfileApi(appSettings, mockRepo);
            var cacheRetrievedData
                = new Operation(mockCache).RetrieveCache(id.ToString(), new Wp.CIS.LynkSystems.Model.MerchantProfile());

            Assert.Equal(cacheRetrievedData, null);
            //since no data in cache, now get data from DB
            MerchantProfileController controller = new MerchantProfileController(mockCache, merchantProfileApi, FakeLogger());

            var merchProfile = await controller.Get(id);

            var actualRecord       = ((Microsoft.AspNetCore.Mvc.ObjectResult)merchProfile).Value;
            var cacheretrieveddata = new Operation(mockCache).RetrieveCache(id.ToString(), new Wp.CIS.LynkSystems.Model.MerchantProfile());

            Assert.Equal(((Wp.CIS.LynkSystems.Model.MerchantProfile)actualRecord).MerchantNbr.ToString(), "007");

            //Assert.Equal(JsonConvert.SerializeObject(actualRecord), JsonConvert.SerializeObject(cacheretrieveddata));
        }
        public async Task MerchantProfileRetrievalFromCache_NotAvailableInCache()
        {
            int id = 191807;
            IOptions <Settings>        appSettings = Substitute.For <IOptions <Settings> >();
            IMerchantProfileRepository mockRepo    = Substitute.For <IMerchantProfileRepository>();

            mockRepo = new MockMerchantRepository();
            IDistributedCache mockCache = FakeCache();

            mockCache = new MockCacheMerchantProfile();
            IMerchantProfileApi merchantProfileApi = new MerchantProfileApi(appSettings, mockRepo);
            //Retrieving from Cache first.
            var cacheRetrievedData
                = new Operation(mockCache).RetrieveCache(id.ToString(), new Wp.CIS.LynkSystems.Model.MerchantProfile());


            //Does not exist in mock Cache. Hence null
            Assert.Equal(cacheRetrievedData, null);

            //since no data in cache, now call the controller. The controller retrieves data and also adds to cache
            MerchantProfileController controller = new MerchantProfileController(mockCache, merchantProfileApi, FakeLogger());
            //Retrieve the data from controller and also check for the data in the cache.
            var merchProfile = await controller.Get(id);

            var actualRecord       = ((Microsoft.AspNetCore.Mvc.ObjectResult)merchProfile).Value;
            var cacheretrieveddata = new Operation(mockCache).RetrieveCache(id.ToString(), new Wp.CIS.LynkSystems.Model.MerchantProfile());

            // Check the retrieved data
            Assert.Equal(((Wp.CIS.LynkSystems.Model.MerchantProfile)actualRecord).MerchantNbr.ToString(), "007");
            // Make sure the data retrieved from controller is same as the data from the cache
            // Assert.Equal(JsonConvert.SerializeObject(actualRecord), JsonConvert.SerializeObject(cacheretrieveddata));
        }