示例#1
0
        public void CacheIsClearedForSpecificType()
        {
            // assemble
            ResourceListCacheManager sut = CreateSut();

            (string berryUri, NamedApiResourceList <Berry> berryList)  = CreateFakeNamedResourceList <Berry>();
            (string machineUri, ApiResourceList <Machine> machineList) = CreateFakeApiResourceList <Machine>();
            sut.Store(berryUri, berryList);
            sut.Store(machineUri, machineList);

            // act
            sut.Clear <Berry>();

            // assert
            NamedApiResourceList <Berry> cachedBerryList   = sut.GetNamedResourceList <Berry>(berryUri);
            ApiResourceList <Machine>    cachedMachineList = sut.GetApiResourceList <Machine>(machineUri);

            Assert.Null(cachedBerryList);
            Assert.NotNull(cachedMachineList);
        }
 /// <summary>
 /// Clears the cached data for a specific resource list
 /// </summary>
 /// <typeparam name="T">The type of cache</typeparam>
 public void ClearResourceListCache <T>() where T : ResourceBase
 {
     _resourceListCache.Clear <T>();
 }