public async Task AirportsService_WhenBypassCache_ShouldCallHttpService()
        {
            // Act
            var result = await AirportsService.GetAirports(true);

            // Assert
            AirportsHttpService.Verify(x => x.Get(), Times.Once);
            Assert.False(result.FromCache);
        }
예제 #2
0
        public async Task <IActionResult> Index()
        {
            var airports = await AirportsService.GetAirports();

            HttpContext.Response.Headers["from-database"] = airports.FromCache.ToString();
            // convert to the viewmodel
            var model = new AirportsViewModel
            {
                Airports = Enumerable.Empty <AirportViewModel>()
            };

            return(View(model));
        }