public MemoryLoggingTests() { logger = Setup.ConfigureDi.Services.GetRequiredService <FakeLogger <LocationCacheMemory> >(); var diskStoragePath = System.Guid.NewGuid().ToString() + ".json"; locationCacheMemory = new LocationCacheMemory(logger); locationCreator = Setup.ConfigureDi.Services.GetRequiredService <LocationCreator>(); }
/// <summary> /// Creates an instance of the LocationCache that has a fake logger attached for /// checking that code is called. /// Suitable for unit and integration testing. /// </summary> /// <returns></returns> public CacheManager Create() { DiskStoragePath = Guid.NewGuid().ToString() + ".json"; L1Logger = serviceProvider.GetRequiredService <FakeLogger <LocationCacheMemory> >(); L2Logger = serviceProvider.GetRequiredService <FakeLogger <LocationCacheDisk> >(); Level1Cache = new LocationCacheMemory(L1Logger); Level2Cache = new LocationCacheDisk(L2Logger, DiskStoragePath); LocationCreator = serviceProvider.GetRequiredService <LocationCreator>(); Logger = serviceProvider.GetRequiredService <FakeLogger <CacheManager> >(); return(new CacheManager(Level1Cache, Level2Cache, LocationCreator, Logger)); }