public void Getting_unsupported_asynchronous_cache_returns_null() { var fakeCacheManager = Substitute.For<ICacheProvider>(); fakeCacheManager .IsAsynchronousSupported .Returns(false); ICacheResolver cacheResolver = new DefaultCacheResolver(fakeCacheManager, Substitute.For<ILogger>()); var cache = cacheResolver.GetAsyncCache(typeof(IAccount)); cache.ShouldBeNull(); }
public void Getting_synchronous_cache() { var fakeCacheManager = Substitute.For<ISynchronousCacheProvider>(); fakeCacheManager .IsSynchronousSupported .Returns(true); fakeCacheManager .GetSyncCache(Arg.Any<string>()) .Returns(Substitute.For<ISynchronousCache>()); ICacheResolver cacheResolver = new DefaultCacheResolver(fakeCacheManager, Substitute.For<ILogger>()); var cache = cacheResolver.GetSyncCache(typeof(IAccount)); cache.ShouldBeAssignableTo<ISynchronousCache>(); }