public void Execute_JobClassProvided_ShouldScheduleNewJob() { const string groupName = "Group"; const string jobName = "Job"; var stub = new SchedulerHostStub(new[] { typeof(System.Object) }); var command = new AddTriggerCommand(() => stub.Value, new RegisteredInputType[0]); AddTriggerOutput result = (AddTriggerOutput)command.Execute(new AddTriggerInput { Group = groupName, Job = jobName, JobClass = typeof(System.Object).ToString(), Name = "Trigger", TriggerType = "Simple" }); result.AssertSuccessfull(); GroupStub group = stub.GetSingleGroup(); JobStub job = group.GetSingleJob(); TriggerStub trigger = job.GetSingleTrigger(); Assert.That(group.Name, Is.EqualTo(groupName)); Assert.That(job.Name, Is.EqualTo(jobName)); Assert.That(job.JobType, Is.EqualTo(typeof(System.Object))); Assert.That(trigger.Name, Is.EqualTo("Trigger")); }
public void Execute_NoJobClass_ShouldAddTriggerToExistingJob() { const string groupName = "Group"; const string jobName = "Job"; var stub = new SchedulerHostStub(); var command = new AddTriggerCommand(() => stub.Value, new RegisteredInputType[0]); AddTriggerOutput result = (AddTriggerOutput)command.Execute(new AddTriggerInput { Group = groupName, Job = jobName, Name = "Trigger", TriggerType = "Simple" }); result.AssertSuccessfull(); GroupStub group = stub.GetSingleGroup(); JobStub job = group.GetSingleJob(); TriggerStub trigger = job.GetSingleTrigger(); Assert.That(group.Name, Is.EqualTo(groupName)); Assert.That(job.Name, Is.EqualTo(jobName)); Assert.That(job.JobType, Is.Null); Assert.That(trigger.Name, Is.EqualTo("Trigger")); }