Пример #1
0
        public void InventoryShouldCacheVehicles()
        {
            // arrange
            MemoryCache memoryCache = new MemoryCache(new MemoryCacheOptions());
            ICarLot     carLot      = new CarLot(memoryCache);

            carLot.Inventory();

            // act // assert
            memoryCache.Get <IInventory>("inventory").VehicleDescriptions().Should().HaveCount(6);
        }
Пример #2
0
        public void InventoryShouldReturnVehicles()
        {
            // arrange
            MemoryCache memoryCache = new MemoryCache(new MemoryCacheOptions());
            ICarLot     carLot      = new CarLot(memoryCache);
            IInventory  inventory   = carLot.Inventory();

            // act
            List <string> vehicleDescriptions = inventory.VehicleDescriptions();

            // assert
            vehicleDescriptions.Should().HaveCount(6);
        }
Пример #3
0
        public void InventoryShouldUseCachedVehicles()
        {
            // arrange
            MemoryCache memoryCache = new MemoryCache(new MemoryCacheOptions());

            memoryCache.Set("inventory", new Inventory(new List <IVehicle>
            {
                new Vehicle(1, 1982, "Ford", "550 Bronco", 12425.95m)
            }), DateTimeOffset.Now.AddMinutes(1));



            ICarLot carLot = new CarLot(memoryCache);

            carLot.Inventory();

            // act // assert
            memoryCache.Get <IInventory>("inventory").VehicleDescriptions().Should().HaveCount(1);
        }