feat(notification-outbox): add NotificationOutboxOptions and delivery adapter abstraction
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using ScadaLink.NotificationOutbox.Delivery;
|
||||
|
||||
namespace ScadaLink.NotificationOutbox.Tests.Delivery;
|
||||
|
||||
public class DeliveryOutcomeTests
|
||||
{
|
||||
[Fact]
|
||||
public void Success_SetsResolvedTargets_AndNoError()
|
||||
{
|
||||
var outcome = DeliveryOutcome.Success("targets");
|
||||
|
||||
Assert.Equal(DeliveryResult.Success, outcome.Result);
|
||||
Assert.Equal("targets", outcome.ResolvedTargets);
|
||||
Assert.Null(outcome.Error);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Transient_SetsError_AndNoResolvedTargets()
|
||||
{
|
||||
var outcome = DeliveryOutcome.Transient("e");
|
||||
|
||||
Assert.Equal(DeliveryResult.TransientFailure, outcome.Result);
|
||||
Assert.Equal("e", outcome.Error);
|
||||
Assert.Null(outcome.ResolvedTargets);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Permanent_SetsError_AndNoResolvedTargets()
|
||||
{
|
||||
var outcome = DeliveryOutcome.Permanent("e");
|
||||
|
||||
Assert.Equal(DeliveryResult.PermanentFailure, outcome.Result);
|
||||
Assert.Equal("e", outcome.Error);
|
||||
Assert.Null(outcome.ResolvedTargets);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace ScadaLink.NotificationOutbox.Tests;
|
||||
|
||||
public class NotificationOutboxOptionsTests
|
||||
{
|
||||
[Fact]
|
||||
public void Defaults_AreExpectedValues()
|
||||
{
|
||||
var options = new NotificationOutboxOptions();
|
||||
|
||||
Assert.Equal(TimeSpan.FromSeconds(10), options.DispatchInterval);
|
||||
Assert.Equal(100, options.DispatchBatchSize);
|
||||
Assert.Equal(TimeSpan.FromMinutes(10), options.StuckAgeThreshold);
|
||||
Assert.Equal(TimeSpan.FromDays(365), options.TerminalRetention);
|
||||
Assert.Equal(TimeSpan.FromDays(1), options.PurgeInterval);
|
||||
Assert.Equal(TimeSpan.FromMinutes(1), options.DeliveredKpiWindow);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user