public PeriodicCacheCleaner(InProcSessionsConfiguration configuration, IInProcSessionCache sessionCache, IPeriodicTaskFactory periodicTaskFactory, ICancellationTokenSourceFactory cancellationTokenSourceFactory) {
   if (configuration == null) throw new ArgumentNullException("configuration");
   if (sessionCache == null) throw new ArgumentNullException("sessionCache");
   if (periodicTaskFactory == null) throw new ArgumentNullException("periodicTaskFactory");
   if (cancellationTokenSourceFactory == null) throw new ArgumentNullException("cancellationTokenSourceFactory");
   _configuration = configuration;
   _cancellationTokenSourceFactory = cancellationTokenSourceFactory;
   _periodicTask = periodicTaskFactory.Create(sessionCache.Trim);
 }
    public PeriodicCacheCleanerFixture() {
      _fakeSessionCache = A.Fake<IInProcSessionCache>();
      _fakePeriodicTaskFactory = A.Fake<IPeriodicTaskFactory>();
      _fakePeriodicTask = A.Fake<IPeriodicTask>();
      _fakeCancellationTokenSourceFactory = A.Fake<ICancellationTokenSourceFactory>();
      _validConfiguration = new InProcSessionsConfiguration();

      _cancellationTokenSource = new CancellationTokenSource();
      A.CallTo(() => _fakeCancellationTokenSourceFactory.Create()).Returns(_cancellationTokenSource);
      A.CallTo(() => _fakePeriodicTaskFactory.Create(A<Action>._)).Returns(_fakePeriodicTask);

      _periodicCacheCleaner = new PeriodicCacheCleaner(_validConfiguration, _fakeSessionCache, _fakePeriodicTaskFactory, _fakeCancellationTokenSourceFactory);
    }
        public PeriodicCacheCleanerFixture()
        {
            _fakeSessionCache                   = A.Fake <IInProcSessionCache>();
            _fakePeriodicTaskFactory            = A.Fake <IPeriodicTaskFactory>();
            _fakePeriodicTask                   = A.Fake <IPeriodicTask>();
            _fakeCancellationTokenSourceFactory = A.Fake <ICancellationTokenSourceFactory>();
            _validConfiguration                 = new InProcSessionsConfiguration();

            _cancellationTokenSource = new CancellationTokenSource();
            A.CallTo(() => _fakeCancellationTokenSourceFactory.Create()).Returns(_cancellationTokenSource);
            A.CallTo(() => _fakePeriodicTaskFactory.Create(A <Action> ._)).Returns(_fakePeriodicTask);

            _periodicCacheCleaner = new PeriodicCacheCleaner(_validConfiguration, _fakeSessionCache, _fakePeriodicTaskFactory, _fakeCancellationTokenSourceFactory);
        }
 public PeriodicCacheCleaner(InProcSessionsConfiguration configuration, IInProcSessionCache sessionCache, IPeriodicTaskFactory periodicTaskFactory, ICancellationTokenSourceFactory cancellationTokenSourceFactory)
 {
     if (configuration == null)
     {
         throw new ArgumentNullException("configuration");
     }
     if (sessionCache == null)
     {
         throw new ArgumentNullException("sessionCache");
     }
     if (periodicTaskFactory == null)
     {
         throw new ArgumentNullException("periodicTaskFactory");
     }
     if (cancellationTokenSourceFactory == null)
     {
         throw new ArgumentNullException("cancellationTokenSourceFactory");
     }
     _configuration = configuration;
     _cancellationTokenSourceFactory = cancellationTokenSourceFactory;
     _periodicTask = periodicTaskFactory.Create(sessionCache.Trim);
 }