public void Getting_unsupported_synchronous_cache_returns_null() { var fakeCacheManager = Substitute.For<ICacheProvider>(); fakeCacheManager .IsSynchronousSupported .Returns(false); ICacheResolver cacheResolver = new DefaultCacheResolver(fakeCacheManager, Substitute.For<ILogger>()); var cache = cacheResolver.GetSyncCache(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>(); }