Skip to content
Snippets Groups Projects
Commit 196e3da4 authored by Klaus Fischer's avatar Klaus Fischer
Browse files

Added testing before sending

parent 1383d9b2
No related branches found
No related tags found
1 merge request!6Routing Api
......@@ -74,7 +74,7 @@ public class Sender : FitConnectClient, ISender, ISenderWithDestination,
Submission!.Data = data;
return this;
}
public Submission? Submission { get; set; }
Submission ISenderReady.Submit() {
......@@ -85,6 +85,13 @@ public class Sender : FitConnectClient, ISender, ISenderWithDestination,
var metadata = CreateMetadata(Submission);
Logger?.LogTrace("MetaData: {metadata}", metadata);
var validationErrors = Subscriber.VerifyMetadata(metadata);
if (validationErrors.Count != 0) {
validationErrors.ToList().ForEach(v => Logger?.LogError("Validation error: {error}", v));
Logger?.LogError("Sending submission aborted due to validation errors");
throw new InvalidOperationException("Submission is not ready");
}
Logger?.LogInformation("Sending submission");
var encryptedMeta = Encryption.Encrypt(metadata);
Logger?.LogTrace("Encrypted metadata: {encryptedMeta}", encryptedMeta);
......@@ -121,8 +128,8 @@ public class Sender : FitConnectClient, ISender, ISenderWithDestination,
/// <returns></returns>
public ISenderWithAttachments WithAttachments(params Attachment[] attachments) =>
WithAttachments(attachments.ToList());
/// <summary>
/// </summary>
/// <param name="attachments"></param>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment