feat(notification-outbox): per-site KPI snapshot type + repository contract
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using ScadaLink.Commons.Types.Notifications;
|
||||
|
||||
namespace ScadaLink.Commons.Tests.Types;
|
||||
|
||||
public class SiteNotificationKpiSnapshotTests
|
||||
{
|
||||
[Fact]
|
||||
public void Constructor_AssignsAllMembers()
|
||||
{
|
||||
var snapshot = new SiteNotificationKpiSnapshot(
|
||||
SourceSiteId: "plant-a",
|
||||
QueueDepth: 5,
|
||||
StuckCount: 2,
|
||||
ParkedCount: 1,
|
||||
DeliveredLastInterval: 40,
|
||||
OldestPendingAge: TimeSpan.FromMinutes(12));
|
||||
|
||||
Assert.Equal("plant-a", snapshot.SourceSiteId);
|
||||
Assert.Equal(5, snapshot.QueueDepth);
|
||||
Assert.Equal(2, snapshot.StuckCount);
|
||||
Assert.Equal(1, snapshot.ParkedCount);
|
||||
Assert.Equal(40, snapshot.DeliveredLastInterval);
|
||||
Assert.Equal(TimeSpan.FromMinutes(12), snapshot.OldestPendingAge);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void OldestPendingAge_IsNullableForSitesWithNoBacklog()
|
||||
{
|
||||
var snapshot = new SiteNotificationKpiSnapshot("plant-b", 0, 0, 0, 0, null);
|
||||
Assert.Null(snapshot.OldestPendingAge);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user