public SessionCreator( ISessionIdGenerator sessionIdGenerator, IDateTimeFactory dateTimeFactory) { _sessionIdGenerator = sessionIdGenerator; _dateTimeFactory = dateTimeFactory; }
public ExpirationRetriever( IDateTimeFactory dateTimeFactory, TimeoutSettings timeoutSettings) { _dateTimeFactory = dateTimeFactory; _timeoutSettings = timeoutSettings; }
public NewsController(IntranetApiContext context, IDateTimeFactory dateTimeFactory, IFileStorageService fileStorageService) { _fileStorageService = fileStorageService; _context = context; _dateTimeFactory = dateTimeFactory; }
/// <summary> /// Mocks time on a date/time with fixed increment on each date/time request. /// </summary> /// <param name="dateTime">Provide date/time in format "yyyy/MM/dd HH:mm:ss"</param> /// <param name="increment">Provide time increment between date/time requests in format "dd.hh:mm:ss.mmm"</param> public MockTimeAdviceAttribute(string dateTime, string increment) : base(false) { this.mock = new TestDateTimeFactory( DateTime.Parse(dateTime, CultureInfo.InvariantCulture), TimeSpan.Parse(increment) ); }
public RegularOperationsFactory( IDateTimeFactory dateTimeFactory, IKeyValueStorage keyValueStorage ) { this.dateTimeFactory = dateTimeFactory; this.keyValueStorage = keyValueStorage; }
public FileTriggeredCacheService(CacheService cacheService, IFileTriggeredCacheConfiguration fileDependentCacheConfiguration, IDateTimeFactory dateTimeFactory) : base(cacheService) { _cacheService = cacheService; _fileDependentCacheConfiguration = fileDependentCacheConfiguration; _dateTimeFactory = dateTimeFactory; }
public Repository( IRepositorySettings repositorySettings, IRepositoryClientFactory repositoryClientFactory, IDateTimeFactory dateTimeFactory ) { this.repositorySettings = repositorySettings; this.dateTimeFactory = dateTimeFactory; repositoryClient = repositoryClientFactory.CreateGitLabClient(repositorySettings.RepositoryId); }
/// <summary> /// Gets the previous event. /// </summary> /// <param name="factory">The factory.</param> /// <param name="dto">The dto.</param> /// <returns>DateTimeOffset.</returns> public virtual DateTimeOffset?GetPreviousOccurrence(IDateTimeFactory factory, DateTimeOffset dto) { var year = dto.Year; while (dto < GetOccurrenceForYear(factory, year)) { --year; } return(GetOccurrenceForYear(factory, year)); }
public OperationsLauncher( IDateTimeFactory dateTimeFactory, IScheduler scheduler, IOperationsLog operationsLog, ILoggerFactory loggerFactory) { this.dateTimeFactory = dateTimeFactory; this.scheduler = scheduler; this.operationsLog = operationsLog; this.loggerFactory = loggerFactory; }
/// <summary> /// Gets the date. /// </summary> /// <param name="factory">The factory.</param> /// <param name="year">The year.</param> /// <returns>DateTimeOffset.</returns> public DateTimeOffset GetOccurrenceForYear(IDateTimeFactory factory, int year) { if (_cache.TryGetValue(year, out var result)) { return(result); } result = GetDate(factory, year); _cache[year] = result; return(result); }
public Worker( IConfiguration configuration, IFileSystem filesystem, ILog log, IDateTimeFactory _datetimeFactory) { _configuration = configuration; _filesystem = filesystem; _log = log; _datetimeFactory = datetimeFactory; }
/// <summary> /// Gets the next event. /// </summary> /// <param name="factory">The factory.</param> /// <param name="dto">The dto.</param> /// <returns>DateTimeOffset.</returns> public virtual DateTimeOffset?GetNextOccurrence(IDateTimeFactory factory, DateTimeOffset dto) { var year = dto.Year; while (GetOccurrenceForYear(factory, year) < dto) { ++year; } return(GetOccurrenceForYear(factory, year)); }
public RepositoryTest() : base() { repositorySettings = mockRepository.Create<IRepositorySettings>(); repositoryClientFactory = mockRepository.Create <IRepositoryClientFactory>(); dateTimeFactory = mockRepository.Create<IDateTimeFactory>(); repositoryClient = mockRepository.Create<IRepositoryClient>(); using (mockRepository.Record()) { var repoId = DataGenerator.GenDigitString(5); repositorySettings.Expect(f => f.RepositoryId).Return(repoId); repositoryClientFactory.Expect(f => f.CreateGitLabClient(repoId)).Return(repositoryClient); } repository = new TaskManagerClient.Repository.Repository(repositorySettings, repositoryClientFactory, dateTimeFactory); }
public DateTimeOffset?GetOccurrence(IDateTimeFactory factory, DateTimeOffset epoch) { _offset.Should().BeGreaterOrEqualTo(0); Current.Should().NotBeNull(); switch (_direction) { case Direction.Forward: return(Current.GetNextOccurrence(factory, epoch)); case Direction.Reverse: return(Current.GetPreviousOccurrence(factory, epoch)); default: throw new InvalidOperationException(); } }
public LastUpdatedDbContextPreProcessor(IDateTimeFactory dateTimeFactory) { _dateTimeFactory = dateTimeFactory; }
public NewsController(IntranetApiContext intranetApiContext, IDateTimeFactory dateTimeFactory) { _dateTimeFactory = dateTimeFactory; _intranetApiContext = intranetApiContext; }
/// <summary> /// Gets the date value. /// </summary> /// <param name="factory">The factory.</param> /// <param name="year">The year.</param> /// <returns>DateTimeOffset.</returns> protected abstract DateTimeOffset GetDate(IDateTimeFactory factory, int year);
/// <summary> /// Mocks time on a date/time advancing with real-time acceleration (x1 would be real-time, x2 would be double speed, x0.5 would be half speed). /// </summary> /// <param name="dateTime">Provide date/time in format "yyyy/MM/dd HH:mm:ss"</param> /// <param name="acceleration">Acceleration as 1 (x1=realtime), 0.5 (halfspeed), 2 (doublespeed), etc.</param> public MockTimeAdviceAttribute(string dateTime, double acceleration) : base(false) { this.mock = new TestDateTimeFactory(DateTime.Parse(dateTime, CultureInfo.InvariantCulture), acceleration); }
internal MemoryStorage(IDateTimeFactory dateTimeFactory) { _dateTimeFactory = dateTimeFactory; }
public BaseDbContext(IDateTimeFactory dateTimeFactory) { _dateTimeFactory = dateTimeFactory; PreProcessors = new List <IDbContextPreProcessor>(); PostProcessors = new List <IDbContextPostProcessor>(); }
public TimeSpan AgeFromNow(this IBorn birthed, IDateTimeFactory dtf) { return(dtf.Now() - birthed.Birth); }
public ConfigurationCache(IEndpointInformationRetrieverFactory endpointRetrieverFactory = null, IDateTimeFactory dateTimeFactory = null) { this.dateTimeFactory = (dateTimeFactory ?? new DateTimeFactory()); this.endpointRetrieverFactory = (endpointRetrieverFactory ?? new EndpointInformationRetrieverFactory()); }
public JwtTokenProvider(IOptions <TokenProviderOptions> settingsOptions, IDateTimeFactory dateTimeFactory) { _settings = settingsOptions.Value; _dateTimeFactory = dateTimeFactory; }
public static DateTimeOffset ToUniversalTime(this DateTime?dateTime, IDateTimeFactory dateTimeFactory) { return(dateTime.HasValue ? new DateTimeOffset(dateTime.Value).ToUniversalTime() : dateTimeFactory.UtcNowWithOffset); }