public TimeProvider() { this.nowCommand = new CherryCommand( "Get Current Time", ca => DateTime.Now, "Returns current time. Present in the system for unit testing purposes."); this.addNewTriggerCommand = new CherryCommand( "Add New Time Trigger", ca => this.ScheduleTrigger(ca as TimeTriggerCommandArgs), "Adds time trigger to the system. Uses standard Quartz trigger. Make sure time is in UTC format."); this.removeExistingTriggerCommand = new CherryCommand( "Remove Existing Time Trigger", ca => { if (!this.sched.IsShutdown) { var jobName = (ca as TimeTriggerCommandArgs).ActionName + jobSuffix; return(this.sched.DeleteJob(jobName, jobsGroup)); } return(true); }, "Removes existing time trigger by its name."); this.scheduleActionCommand = new CherryCommand( "Schedule Single Action", ca => this.ScheduleAction(ca as SingleActionCommandArgs), "Schedule action to execute it once. After the execution the time trigger is removed automatically. Make sure time is in local time format."); this.InitializeScheduler(); }
public FakeTimeProvider() { Now = DateTime.Now; this.nowCommand = new CherryCommand("Get Current Time", ca => this.Now); this.addNewTriggerCommand = new CherryCommand("Add New Time Trigger", ca => true); this.removeExistingTriggerCommand = new CherryCommand("Remove Existing Time Trigger", ca => true); this.scheduleActionCommand = new CherryCommand("Schedule Single Action", ca => true); }
public FakeIconController() { this.flashIconCommand = new CherryCommand( "Flash Icon", fica => true); this.showBaloonCommand = new CherryCommand( "Show Balloon Tip", btca => true); }
public void CreateCherryCommandListenerTest() { CherryCommandArgs sentArgs = new CherryCommandArgs(); const string listenerName = "listener Name"; var rl = new CherryCommand( listenerName, ra => { Assert.AreEqual(sentArgs, ra); return(1); }); Assert.AreEqual(listenerName, rl.Name); Assert.AreEqual(1, rl.Do(sentArgs)); }
public OutOfPomodoroReminder() { this.outOfPomodoroTriggerCommand = new CherryCommand( "Out Of Pomodoro Trigger", ca => { var minutes = (ca as OutOfPomodoroCommandArgs).RemindAtMinutes; if (minutes == 0) { return(false); } // Uncomment to test reminder with 5,10,15 seconds delay. But not minutes! //var triggeringTime = ((DateTime)getCurrentTimeCommand.Do(null)).AddSeconds(minutes); var triggeringTime = ((DateTime)getCurrentTimeCommand.Do(null)).AddMinutes(minutes); this.SetTriggerAt(triggeringTime); return(true); }, "Sets next Out Of Pomodoro notification time."); }