feat(notification-outbox): add Notification entity

This commit is contained in:
Joseph Doherty
2026-05-19 00:48:48 -04:00
parent 926ca902bd
commit 397a62677f
2 changed files with 81 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
using ScadaLink.Commons.Entities.Notifications;
using ScadaLink.Commons.Types.Enums;
namespace ScadaLink.Commons.Tests.Entities;
/// <summary>
/// Verifies the <see cref="Notification"/> outbox entity's constructor defaults
/// and null-argument guards on required reference-type parameters.
/// </summary>
public class NotificationEntityTests
{
[Fact]
public void Constructor_SetsDefaults()
{
var n = new Notification("id-1", NotificationType.Email, "ops-team", "subj", "body", "SiteA");
Assert.Equal(NotificationStatus.Pending, n.Status);
Assert.Equal(0, n.RetryCount);
Assert.Equal("id-1", n.NotificationId);
Assert.Equal(NotificationType.Email, n.Type);
Assert.Equal("ops-team", n.ListName);
Assert.Equal("SiteA", n.SourceSiteId);
}
[Fact]
public void Constructor_NullListName_Throws()
=> Assert.Throws<ArgumentNullException>(
() => new Notification("id", NotificationType.Email, null!, "s", "b", "SiteA"));
[Fact]
public void Constructor_NullNotificationId_Throws()
=> Assert.Throws<ArgumentNullException>(
() => new Notification(null!, NotificationType.Email, "list", "s", "b", "SiteA"));
}