public async Task GetProviderById_WhenProviderVersionIdDoesNotExistsForDate_NotFoundReturned(int day, int month, int year)
        {
            // Arrange
            ProviderVersionViewModel providerVersionViewModel = CreateProviderVersion();

            Provider provider = GetProvider();

            providerVersionViewModel.Providers   = providerVersionViewModel.Providers.Concat(new[] { provider });
            providerVersionViewModel.VersionType = ProviderVersionType.Custom;

            ICacheProvider cacheProvider = CreateCacheProvider();

            SearchResults <ProvidersIndex> searchResults = new SearchResults <ProvidersIndex>();

            ISearchRepository <ProvidersIndex> searchRepository = CreateSearchRepository();

            searchRepository
            .Search(Arg.Any <string>(), Arg.Any <SearchParameters>())
            .Returns(searchResults);

            IProviderVersionsMetadataRepository providerVersionMetadataRepository = CreateProviderVersionMetadataRepository();

            string providerVersionId = Guid.NewGuid().ToString();

            providerVersionMetadataRepository
            .GetProviderVersionByDate(Arg.Any <int>(), Arg.Any <int>(), Arg.Any <int>())
            .Returns <ProviderVersionByDate>((ProviderVersionByDate)null);

            IProviderVersionSearchService providerService = CreateProviderVersionSearchService(cacheProvider: cacheProvider, searchRepository: searchRepository, providerVersionMetadataRepository: providerVersionMetadataRepository);

            // Act
            IActionResult notFoundRequest = await providerService.GetProviderById(year, month, day, "12345");

            notFoundRequest
            .Should()
            .BeOfType <NotFoundResult>();
        }
        public async Task <ProviderVersionByDate> GetProviderVersionByDate(int year, int month, int day)
        {
            string cacheKey = $"{CacheKeys.ProviderVersionByDate}{year}{month:00}{day:00}";

            ProviderVersionByDate providerVersionByDate = await _cachePolicy.ExecuteAsync(()
                                                                                          => _cacheProvider.GetAsync <ProviderVersionByDate>(cacheKey));

            if (providerVersionByDate == null)
            {
                providerVersionByDate = await _providerVersionMetadataRepositoryPolicy.ExecuteAsync(() => _providerVersionMetadataRepository.GetProviderVersionByDate(year, month, day));

                await _cacheProvider.SetAsync(cacheKey, providerVersionByDate, TimeSpan.FromDays(CACHE_DURATION), true);
            }

            return(providerVersionByDate);
        }