protected internal virtual async Task <DateTimeOffsetCacheOptionsMock> CreateDateTimeOffsetCacheOptionsMockAsync(TimeSpan?cleanupInterval = null, TimeSpan?defaultSlidingExpiration = null) { var options = new DateTimeOffsetCacheOptionsMock { CleanupInterval = cleanupInterval }; if (defaultSlidingExpiration != null) { options.DefaultSlidingExpiration = defaultSlidingExpiration.Value; } return(await Task.FromResult(options)); }
protected internal virtual async Task <DateTimeOffsetCacheMock> CreateContextCacheAsync(DateTimeOffsetCacheOptionsMock options = null, ISystemClock systemClock = null) { options ??= await this.CreateDateTimeOffsetCacheOptionsMockAsync(); systemClock ??= new SystemClockMock(); var optionsMonitorMock = new Mock <IOptionsMonitor <DateTimeOffsetCacheOptionsMock> >(); optionsMonitorMock.Setup(optionsMonitor => optionsMonitor.CurrentValue).Returns(options); return(await Task.FromResult(new DateTimeOffsetCacheMock(Mock.Of <IDbContextFactory <SqlServerCacheContext> >(), Mock.Of <ILoggerFactory>(), optionsMonitorMock.Object, systemClock))); }