fix(transport): preserve MinTimeBetweenRuns + ExternalSystem retry fields in bundle DTOs
Add TimeSpan? MinTimeBetweenRuns to TemplateScriptDto and int MaxRetries / TimeSpan RetryDelay to ExternalSystemDto; wire both directions in EntitySerializer. Extends the existing script round-trip assertion and adds Roundtrip_external_system_preserves_retry_config.
This commit is contained in:
@@ -96,6 +96,7 @@ public sealed class EntitySerializerTests
|
||||
ParameterDefinitions = "[]",
|
||||
ReturnDefinition = "void",
|
||||
IsLocked = false,
|
||||
MinTimeBetweenRuns = TimeSpan.FromSeconds(30),
|
||||
});
|
||||
|
||||
var assembly = new Template("Assembly") { Id = 2, FolderId = 1 };
|
||||
@@ -133,6 +134,7 @@ public sealed class EntitySerializerTests
|
||||
Assert.Equal("OnUpdate", rtScript.Name);
|
||||
Assert.Equal("return 1;", rtScript.Code);
|
||||
Assert.Equal("Periodic", rtScript.TriggerType);
|
||||
Assert.Equal(TimeSpan.FromSeconds(30), rtScript.MinTimeBetweenRuns);
|
||||
|
||||
var rtAssembly = Assert.Single(roundTripped.Templates, t => t.Name == "Assembly");
|
||||
var rtComp = Assert.Single(rtAssembly.Compositions);
|
||||
@@ -164,6 +166,27 @@ public sealed class EntitySerializerTests
|
||||
Assert.Equal(rtRoot.Id, rtChild.ParentFolderId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Roundtrip_external_system_preserves_retry_config()
|
||||
{
|
||||
var sys = new ExternalSystemDefinition("billing", "https://billing/api", "Basic")
|
||||
{
|
||||
Id = 1,
|
||||
MaxRetries = 5,
|
||||
RetryDelay = TimeSpan.FromSeconds(15),
|
||||
};
|
||||
var aggregate = MakeEmptyAggregate() with { ExternalSystems = new[] { sys } };
|
||||
|
||||
var sut = new EntitySerializer();
|
||||
var dto = sut.ToBundleContent(aggregate);
|
||||
var roundTripped = sut.FromBundleContent(dto);
|
||||
|
||||
var rtSys = Assert.Single(roundTripped.ExternalSystems);
|
||||
Assert.Equal("billing", rtSys.Name);
|
||||
Assert.Equal(5, rtSys.MaxRetries);
|
||||
Assert.Equal(TimeSpan.FromSeconds(15), rtSys.RetryDelay);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FromDto_with_null_SecretsBlock_yields_entity_with_default_empty_secrets()
|
||||
{
|
||||
@@ -173,7 +196,7 @@ public sealed class EntitySerializerTests
|
||||
SharedScripts: Array.Empty<SharedScriptDto>(),
|
||||
ExternalSystems: new[]
|
||||
{
|
||||
new ExternalSystemDto("erp", "https://x", "None", Array.Empty<ExternalSystemMethodDto>(), Secrets: null),
|
||||
new ExternalSystemDto("erp", "https://x", "None", MaxRetries: 3, RetryDelay: TimeSpan.FromSeconds(5), Array.Empty<ExternalSystemMethodDto>(), Secrets: null),
|
||||
},
|
||||
DatabaseConnections: Array.Empty<DatabaseConnectionDto>(),
|
||||
NotificationLists: Array.Empty<NotificationListDto>(),
|
||||
|
||||
Reference in New Issue
Block a user