public DataTransferService(IRemoteDataServiceFactory remoteDataServiceFactory,
     ICallCopyServiceFactory callCopyServiceFactory,
     ITimerWrapper timer, IConfigurationManagerWrapper configurationManager)
 {
     InitializeComponent();
     _remoteDataServiceFactory = remoteDataServiceFactory;
     _timer = timer;
     _configurationManager = configurationManager;
     _transferer = new Transferer(callCopyServiceFactory.Construct(configurationManager));
 }
        public FileSystemSyncWhenScheduled(IOneWaySynchronizer oneWaySynchronizer, ITimerWrapper timer)
        {
            if (oneWaySynchronizer == null)
                throw new ArgumentNullException(nameof(oneWaySynchronizer));

            if (timer == null)
                throw new ArgumentNullException(nameof(timer));

            _oneWaySynchronizer = oneWaySynchronizer;
            _timer = timer;

            _timer.Elapsed += TimerOnElapsed;
        }
        public FileSystemWatcherAdapter(FileSystemWatcher fileSystemWatcher, ITimerWrapper timerWrapper, IFileLockHelper fileLockHelper)
        {
            if (fileSystemWatcher == null)
                throw new ArgumentNullException(nameof(fileSystemWatcher));

            if (timerWrapper == null)
                throw new ArgumentNullException(nameof(timerWrapper));

            if (fileLockHelper == null)
                throw new ArgumentNullException(nameof(fileLockHelper));

            _timerWrapper = timerWrapper;
            _fileLockHelper = fileLockHelper;

            _timerWrapper.Interval = BlockingInterval;
            _timerWrapper.Elapsed += TimerOnElapsed;

            SetupFileSystemWatcher(fileSystemWatcher);
        }
示例#4
0
 public void Setup()
 {
     _fakeTimer   = Substitute.For <ITimerWrapper>();
     _fakeWatcher = Substitute.For <IFileSystemWatcherWrapper>();
     _uut         = new FileMonitor(_fakeWatcher, _fakeTimer);
 }
示例#5
0
 public FileMonitor(IFileSystemWatcherWrapper watcher, ITimerWrapper timer) : base(watcher)
 {
     _timer = timer;
 }
示例#6
0
 public Form1(ITimerWrapper timerWrapper)
 {
     InitializeComponent();
     this._timerWrapper          = timerWrapper; // of course this is done via dependency injection
     this._timerWrapper.Interval = 1000;
 }
示例#7
0
 private TimeManager CreateTimeManager(ITimerWrapper timer)
 {
     return(new TimeManager(timer));
 }
示例#8
0
 public TimeManager(ITimerWrapper timer)
 {
     _timer          = timer;
     _timer.Interval = DefaultTimerInterval;
 }