public void Execute_UnknownInputType_ShouldReturnValidationIssue() { var stub = new SchedulerHostStub(); var command = new AddTriggerCommand(() => stub.Value, new RegisteredInputType[0]); AddTriggerOutput result = (AddTriggerOutput)command.Execute(new AddTriggerInput { TriggerType = "Cron", JobDataMap = new[] { new JobDataItem { Key = "CustomKey", Value = "CustomCode", InputTypeCode = "custom" }, } }); stub.AssertEmpty(); result.AssertSuccessfull(); Assert.That(result.ValidationErrors, Is.Not.Null); Assert.That(result.ValidationErrors["CustomKey"], Is.EqualTo("Unknown input type: custom")); }
public void Execute_ValidJobDataConversionIssue_ShouldReturnValidationIssue() { var converter = Substitute.For <IInputTypeConverter>(); converter.Convert("CustomCode").Throws(new Exception("Custom conversion issue")); var stub = new SchedulerHostStub(new Type[0]); var command = new AddTriggerCommand(() => stub.Value, new[] { new RegisteredInputType(new InputType("custom"), converter) }); AddTriggerOutput result = (AddTriggerOutput)command.Execute(new AddTriggerInput { TriggerType = "Cron", JobDataMap = new[] { new JobDataItem { Key = "CustomKey", Value = "CustomCode", InputTypeCode = "custom" }, } }); stub.AssertEmpty(); result.AssertSuccessfull(); Assert.That(result.ValidationErrors, Is.Not.Null); Assert.That(result.ValidationErrors["CustomKey"], Is.EqualTo("Custom conversion issue")); }
public void Execute_UnknownTriggerType_ShouldReturnError() { var stub = new SchedulerHostStub(); var command = new AddTriggerCommand(() => stub.Value, new RegisteredInputType[0]); AddTriggerOutput result = (AddTriggerOutput)command.Execute(new AddTriggerInput { TriggerType = "Unsupported" }); Assert.That(result.Success, Is.False, "Success"); Assert.That(result.ErrorMessage, Is.Not.Null); stub.AssertEmpty(); }