public void Ctors() { UnknownJobException ex = new UnknownJobException("UnknownJobExceptionTest-Ctors", "UnknownJob"); Assert.That("UnknownJobExceptionTest-Ctors", Is.EqualTo(ex.MessageId)); Assert.That("The job 'UnknownJob' from message with ID 'UnknownJobExceptionTest-Ctors' is unknown.", Is.EqualTo(ex.Message)); }
public void SerializationDeserialization() { UnknownJobException ex = new UnknownJobException("UnknownJobExceptionTest-SerializationDeserialization", "UnknownJob"); string serialized = JsonConvert.SerializeObject(ex); UnknownJobException ex2 = JsonConvert.DeserializeObject<UnknownJobException>(serialized); Assert.That(ex2.MessageId, Is.EqualTo("UnknownJobExceptionTest-SerializationDeserialization")); Assert.That(ex2.JobName, Is.EqualTo("UnknownJob")); }
public void SerializationDeserialization() { UnknownJobException ex = new UnknownJobException("UnknownJobExceptionTest-SerializationDeserialization", "UnknownJob"); string serialized = JsonConvert.SerializeObject(ex); UnknownJobException ex2 = JsonConvert.DeserializeObject <UnknownJobException>(serialized); Assert.That(ex2.MessageId, Is.EqualTo("UnknownJobExceptionTest-SerializationDeserialization")); Assert.That(ex2.JobName, Is.EqualTo("UnknownJob")); }
public Task ExecuteAsync(string jobName, int version, string json, CancellationToken cancellationToken) { if (!_jobDefinitionService.TryGetDefinition(jobName, version, out var jobDefinition)) { throw UnknownJobException.With(jobName, version); } var executeCommandJob = (IJob)_jsonSerializer.Deserialize(json, jobDefinition.Type); return(executeCommandJob.ExecuteAsync(_serviceProvider, cancellationToken)); }