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

Changed due to review

parent a1d61e6c
No related branches found
No related tags found
1 merge request!3Feature/440 mvp net sdk part 1
......@@ -11,14 +11,19 @@ namespace FluentApiTest;
public class FluentSenderTests {
private IContainer _container = null!;
protected string clientId = "20175c2b-c4dd-4a01-99b1-3a08436881a1";
protected string clientSecret = "KV2qd7qc5n-xESB6dvfrTlMDx2BWHJd5hXJ6pKKnbEQ";
protected string clientId = null!;
protected string clientSecret = null!;
private ILogger? logger;
private string leikaKey = null!;
[OneTimeSetUp]
public void OneTimeSetup() {
_container = Container.Create();
logger = _container.Resolve<ILogger>();
var settings = _container.Resolve<MockSettings>();
clientId = settings.SenderClientId;
clientSecret = settings.SenderClientSecret;
leikaKey = settings.LeikaKey;
}
[SetUp]
......@@ -45,7 +50,7 @@ public class FluentSenderTests {
clientId, clientSecret,
Container.Create())
.WithDestination(Guid.NewGuid().ToString())
.WithServiceType("", "urn:de:fim:leika:leistung:99400048079000")
.WithServiceType("", leikaKey)
.WithAttachments(Array.Empty<Attachment>())
.WithData("")
.Submit();
......@@ -57,7 +62,7 @@ public class FluentSenderTests {
clientId, clientSecret,
Container.Create())
.WithDestination(Guid.NewGuid().ToString())
.WithServiceType("", "urn:de:fim:leika:leistung:99400048079000")
.WithServiceType("", leikaKey)
.WithAttachments(Array.Empty<Attachment>())
.Submit();
}
......@@ -66,7 +71,7 @@ public class FluentSenderTests {
public void VerifyMetaData_ValidData_Fine() {
// Arrange
var submission = new Submission();
submission.ServiceType.Identifier = "urn:de:fim:leika:leistung:99400048079000";
submission.ServiceType.Identifier = leikaKey;
// Act
var metadata = Sender.CreateMetadata(submission);
......@@ -82,7 +87,6 @@ public class FluentSenderTests {
public void VerifyMetaData_MissingLeikaKey_ThorwsAnError() {
// Arrange
var submission = new Submission();
//submission.ServiceType.Identifier = "urn:de:fim:leika:leistung:99400048079000";
// Act
var metadata = Sender.CreateMetadata(submission);
......
......@@ -10,8 +10,14 @@ namespace FluentApiTest;
[TestFixture]
public class SecurityEventTokenTests {
private const string rejectSubmission =
"https://schema.fitko.de/fit-connect/events/reject-submission";
private FitEncryption _encryption = null!;
private const string acceptSubmission =
"https://schema.fitko.de/fit-connect/events/accept-submission";
[SetUp]
public void Setup() {
var container = MockContainer.Container.Create();
......@@ -23,13 +29,13 @@ public class SecurityEventTokenTests {
var token = _encryption.CreateSecurityEventToken(Guid.NewGuid().ToString(),
Guid.NewGuid().ToString(),
Guid.NewGuid().ToString(),
"https://schema.fitko.de/fit-connect/events/accept-submission",
acceptSubmission,
null
);
Console.WriteLine(token);
var decoded = new FitConnect.Models.SecurityEventToken(token);
decoded.Event?.Type.Should()
.Be("https://schema.fitko.de/fit-connect/events/accept-submission");
.Be(acceptSubmission);
decoded.EventType.Should().Be(EventType.Accept);
}
......@@ -38,13 +44,13 @@ public class SecurityEventTokenTests {
var token = _encryption.CreateSecurityEventToken(Guid.NewGuid().ToString(),
Guid.NewGuid().ToString(),
Guid.NewGuid().ToString(),
"https://schema.fitko.de/fit-connect/events/reject-submission",
rejectSubmission,
new[] { Problems.EncryptionIssue }
);
Console.WriteLine(token);
var decoded = new FitConnect.Models.SecurityEventToken(token);
decoded.Event?.Type.Should()
.Be("https://schema.fitko.de/fit-connect/events/reject-submission");
.Be(rejectSubmission);
decoded.EventType.Should().Be(EventType.Reject);
}
......@@ -53,13 +59,13 @@ public class SecurityEventTokenTests {
var token = _encryption.CreateSecurityEventToken(Guid.NewGuid().ToString(),
Guid.NewGuid().ToString(),
Guid.NewGuid().ToString(),
"https://schema.fitko.de/fit-connect/events/reject-submission",
rejectSubmission,
new[] { Problems.MissingSchema }
);
Console.WriteLine(token);
var decoded = new FitConnect.Models.SecurityEventToken(token);
decoded.Event?.Type.Should()
.Be("https://schema.fitko.de/fit-connect/events/reject-submission");
.Be(rejectSubmission);
decoded.EventType.Should().Be(EventType.Reject);
}
......@@ -69,13 +75,13 @@ public class SecurityEventTokenTests {
var token = _encryption.CreateSecurityEventToken(Guid.NewGuid().ToString(),
Guid.NewGuid().ToString(),
Guid.NewGuid().ToString(),
"https://schema.fitko.de/fit-connect/events/reject-submission",
rejectSubmission,
new[] { Problems.SchemaViolation }
);
Console.WriteLine(token);
var decoded = new FitConnect.Models.SecurityEventToken(token);
decoded.Event?.Type.Should()
.Be("https://schema.fitko.de/fit-connect/events/reject-submission");
.Be(rejectSubmission);
decoded.EventType.Should().Be(EventType.Reject);
}
......@@ -84,14 +90,14 @@ public class SecurityEventTokenTests {
var token = _encryption.CreateSecurityEventToken(Guid.NewGuid().ToString(),
Guid.NewGuid().ToString(),
Guid.NewGuid().ToString(),
"https://schema.fitko.de/fit-connect/events/reject-submission",
rejectSubmission,
new[] { Problems.SyntaxViolation }
);
Console.WriteLine(token);
var decoded = new FitConnect.Models.SecurityEventToken(token);
decoded.Event?.Type.Should()
.Be("https://schema.fitko.de/fit-connect/events/reject-submission");
.Be(rejectSubmission);
decoded.EventType.Should().Be(EventType.Reject);
}
......@@ -100,13 +106,13 @@ public class SecurityEventTokenTests {
var token = _encryption.CreateSecurityEventToken(Guid.NewGuid().ToString(),
Guid.NewGuid().ToString(),
Guid.NewGuid().ToString(),
"https://schema.fitko.de/fit-connect/events/reject-submission",
rejectSubmission,
new[] { Problems.UnsupportedSchema }
);
Console.WriteLine(token);
var decoded = new FitConnect.Models.SecurityEventToken(token);
decoded.Event?.Type.Should()
.Be("https://schema.fitko.de/fit-connect/events/reject-submission");
.Be(rejectSubmission);
decoded.EventType.Should().Be(EventType.Reject);
}
......@@ -115,13 +121,13 @@ public class SecurityEventTokenTests {
var token = _encryption.CreateSecurityEventToken(Guid.NewGuid().ToString(),
Guid.NewGuid().ToString(),
Guid.NewGuid().ToString(),
"https://schema.fitko.de/fit-connect/events/reject-submission",
rejectSubmission,
new[] { Problems.IncorrectAuthenticationTag }
);
Console.WriteLine(token);
var decoded = new FitConnect.Models.SecurityEventToken(token);
decoded.Event?.Type.Should()
.Be("https://schema.fitko.de/fit-connect/events/reject-submission");
.Be(rejectSubmission);
decoded.EventType.Should().Be(EventType.Reject);
}
......@@ -130,13 +136,13 @@ public class SecurityEventTokenTests {
var token = _encryption.CreateSecurityEventToken(Guid.NewGuid().ToString(),
Guid.NewGuid().ToString(),
Guid.NewGuid().ToString(),
"https://schema.fitko.de/fit-connect/events/reject-submission",
rejectSubmission,
new[] { new Problems() { Description = "A real big issue" } }
);
Console.WriteLine(token);
var decoded = new FitConnect.Models.SecurityEventToken(token);
decoded.Event?.Type.Should()
.Be("https://schema.fitko.de/fit-connect/events/reject-submission");
.Be(rejectSubmission);
decoded.EventType.Should().Be(EventType.Reject);
}
}
......@@ -3,6 +3,7 @@
"Sender": {
"ClientId": "00000000-0000-0000-0000-000000000000",
"ClientSecret": "",
"DestinationId": "00000000-0000-0000-0000-000000000000",
"LeikaKey": "urn:de:fim:leika:leistung:99400048079000"
},
"Subscriber": {
......
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