Beispiel #1
0
            protected void Reset()
            {
                var analyticsService        = Substitute.For <IAnalyticsService>();
                var lastTimeUsageStorage    = Substitute.For <ILastTimeUsageStorage>();
                var timeService             = Substitute.For <ITimeService>();
                var automaticSyncingService = Substitute.For <IAutomaticSyncingService>();

                Queue        = new SyncStateQueue();
                Transitions  = new TransitionHandlerProvider(analyticsService);
                Scheduler    = new TestScheduler();
                StateMachine = new StateMachine(Transitions, Scheduler);
                EntryPoints  = new StateMachineEntryPoints();
                Orchestrator = new StateMachineOrchestrator(StateMachine, EntryPoints);
                SyncManager  = new SyncManager(Queue, Orchestrator, analyticsService, lastTimeUsageStorage, timeService, automaticSyncingService);
            }
Beispiel #2
0
        public static ISyncManager CreateSyncManager(
            ITogglDatabase database,
            ITogglApi api,
            ITogglDataSource dataSource,
            ITimeService timeService,
            IScheduler scheduler)
        {
            var queue       = new SyncStateQueue();
            var entryPoints = new StateMachineEntryPoints();
            var transitions = new TransitionHandlerProvider();

            ConfigureTransitions(transitions, database, api, dataSource, scheduler, timeService, entryPoints);
            var stateMachine = new StateMachine(transitions, scheduler);
            var orchestrator = new StateMachineOrchestrator(stateMachine, entryPoints);

            return(new SyncManager(queue, orchestrator));
        }
        public static ISyncManager CreateSyncManager(
            ITogglDatabase database,
            ITogglApi api,
            ITogglDataSource dataSource,
            ITimeService timeService,
            IScheduler scheduler)
        {
            var queue                       = new SyncStateQueue();
            var entryPoints                 = new StateMachineEntryPoints();
            var transitions                 = new TransitionHandlerProvider();
            var delayCancellation           = new Subject <Unit>();
            var delayCancellationObservable = delayCancellation.AsObservable().Replay();

            ConfigureTransitions(transitions, database, api, dataSource, scheduler, timeService, entryPoints, delayCancellationObservable);
            var stateMachine = new StateMachine(transitions, scheduler, delayCancellation);
            var orchestrator = new StateMachineOrchestrator(stateMachine, entryPoints);

            return(new SyncManager(queue, orchestrator));
        }
        public static ISyncManager CreateSyncManager(
            ITogglDatabase database,
            ITogglApi api,
            ITogglDataSource dataSource,
            ITimeService timeService,
            IAnalyticsService analyticsService,
            ILastTimeUsageStorage lastTimeUsageStorage,
            IScheduler scheduler,
            IAutomaticSyncingService automaticSyncingService)
        {
            var queue       = new SyncStateQueue();
            var entryPoints = new StateMachineEntryPoints();
            var transitions = new TransitionHandlerProvider(analyticsService);

            ConfigureTransitions(transitions, database, api, dataSource, scheduler, timeService, analyticsService, lastTimeUsageStorage, entryPoints, queue);
            var stateMachine = new StateMachine(transitions, scheduler);
            var orchestrator = new StateMachineOrchestrator(stateMachine, entryPoints);

            return(new SyncManager(queue, orchestrator, analyticsService, lastTimeUsageStorage, timeService, automaticSyncingService));
        }
        public static ISyncManager CreateSyncManager(
            ITogglDatabase database,
            ITogglApi api,
            ITogglDataSource dataSource,
            ITimeService timeService,
            IAnalyticsService analyticsService,
            ILastTimeUsageStorage lastTimeUsageStorage,
            TimeSpan?retryLimit,
            IScheduler scheduler)
        {
            var random                      = new Random();
            var queue                       = new SyncStateQueue();
            var entryPoints                 = new StateMachineEntryPoints();
            var transitions                 = new TransitionHandlerProvider();
            var apiDelay                    = new RetryDelayService(random, retryLimit);
            var delayCancellation           = new Subject <Unit>();
            var delayCancellationObservable = delayCancellation.AsObservable().Replay();

            ConfigureTransitions(transitions, database, api, dataSource, apiDelay, scheduler, timeService, analyticsService, entryPoints, delayCancellationObservable);
            var stateMachine = new StateMachine(transitions, scheduler, delayCancellation);
            var orchestrator = new StateMachineOrchestrator(stateMachine, entryPoints);

            return(new SyncManager(queue, orchestrator, analyticsService, lastTimeUsageStorage, timeService));
        }