public async Task FetchSampleData_FirstFetchWithDefaultOption_ReturnApiData()
        {
            _cache.Setup(cache => cache.InMemoryData).Returns(new List <OpenExchangeRateResult>());

            IEnumerable <OpenExchangeRateResult> clientResult = new List <OpenExchangeRateResult>
            {
                new OpenExchangeRateResult
                {
                    Base      = "USD",
                    TimeStamp = 35343423,
                    Rates     = new Dictionary <string, double>
                    {
                        { "VND", 23455 },
                        { "CYN", 6435 }
                    }
                },
                new OpenExchangeRateResult
                {
                    Base      = "USD",
                    TimeStamp = 35343423,
                    Rates     = new Dictionary <string, double>
                    {
                        { "VND", 24455 },
                        { "CYN", 6535 }
                    }
                }
            };

            _openExchangeClient
            .Setup(client =>
                   client.GetExchangeRateHistoryPeriod(It.IsAny <DateTime>(), It.IsAny <DateTime>(),
                                                       It.IsAny <PeriodMode>())).Returns(Task.FromResult(clientResult));

            var predictionService = new PredictionService(_openExchangeClient.Object, _cache.Object);

            var result = await predictionService.FetchSampleData(new DateTime(2016, 1, 1), new DateTime(2016, 12, 1));

            Approvals.VerifyJson(JsonConvert.SerializeObject(_cache.Object.InMemoryData));
            Approvals.VerifyJson(JsonConvert.SerializeObject(result));
        }
        public async Task FetchSampleData_FetchWithCacheData_ReturnCache()
        {
            _cache.Setup(cache => cache.InMemoryData).Returns(new List <OpenExchangeRateResult>
            {
                new OpenExchangeRateResult
                {
                    Base      = "USD",
                    TimeStamp = 34343423,
                    Rates     = new Dictionary <string, double>
                    {
                        { "VND", 23455 },
                        { "CYN", 6435 }
                    }
                }
            });

            var predictionService = new PredictionService(_openExchangeClient.Object, _cache.Object);

            var result = await predictionService.FetchSampleData(new DateTime(2016, 1, 1), new DateTime(2016, 12, 1));

            _openExchangeClient.Verify(client => client.GetExchangeRateHistoryPeriod(It.IsAny <DateTime>(), It.IsAny <DateTime>(), It.IsAny <PeriodMode>()), Times.Never);
            _cache.Verify(cache => cache.InMemoryData, Times.Exactly(2));
            Approvals.VerifyJson(JsonConvert.SerializeObject(result));
        }