public async Task CachingVehicleService_SkipRepeated_Test()
        {
            var memoryCache = CreateCache();
            var pingCount   = 0;
            var underlying  = new Mock <IVehicleService>();

            underlying
            .Setup(x => x.Ping(It.IsAny <string>()))
            .Returns <string>((id) => Task.FromResult(new VehicleStatusMessage(id, VehicleStatus.Connected)))
            .Callback(() => pingCount++);

            var logger = CommonUtils.CreateLogger <CachingVehicleService>();

            var vehicleService = new CachingVehicleService(underlying.Object, memoryCache, logger);

            var request = new VehicleTrackRequest("1");
            var result  = await vehicleService.Ping(request);

            var result2 = await vehicleService.Ping(request);

            pingCount.ShouldBe(1);

            result.ShouldNotBeNull();
            result.Id.ShouldBe("1");

            result2.ShouldBeNull();
        }
        public async Task CachingVehicleService_SkipOutdated_Test()
        {
            var memoryCache = new Mock <IMemoryCache>();
            var underlying  = new Mock <IVehicleService>();

            underlying
            .Setup(x => x.Ping(It.IsAny <string>()))
            .Throws(new Exception("Underlying ping is called"));
            var logger = CommonUtils.CreateLogger <CachingVehicleService>();

            var vehicleService = new CachingVehicleService(underlying.Object, memoryCache.Object, logger);

            var request = new VehicleTrackRequest("1")
            {
                TimeUtc = DateTime.UtcNow.AddDays(-1)
            };
            var result = await vehicleService.Ping(request);

            result.ShouldBeNull();
        }