feat(sms): CLI list --type/--phones + notification sms group + channel-aware recipients (S6)
This commit is contained in:
@@ -1365,6 +1365,43 @@ public class ManagementActorTests : TestKit, IDisposable
|
||||
Assert.Equal(Commons.Types.Enums.NotificationType.Sms, added!.Type);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CreateNotificationList_WithSmsTypeAndPhones_PersistsForSmsRecipients()
|
||||
{
|
||||
// S6: an SMS list builds recipients from RecipientPhones via NotificationRecipient.ForSms
|
||||
// — PhoneNumber set, EmailAddress null (the off-channel RecipientEmails list is ignored).
|
||||
var notifRepo = Substitute.For<INotificationRepository>();
|
||||
Commons.Entities.Notifications.NotificationList? added = null;
|
||||
notifRepo.When(r => r.AddNotificationListAsync(
|
||||
Arg.Any<Commons.Entities.Notifications.NotificationList>(), Arg.Any<CancellationToken>()))
|
||||
.Do(ci => added = ci.Arg<Commons.Entities.Notifications.NotificationList>());
|
||||
_services.AddScoped(_ => notifRepo);
|
||||
|
||||
var actor = CreateActor();
|
||||
var envelope = Envelope(
|
||||
new CreateNotificationListCommand(
|
||||
"Ops SMS",
|
||||
Array.Empty<string>(),
|
||||
Commons.Types.Enums.NotificationType.Sms,
|
||||
new[] { "+15551230000", "+15551230001" }),
|
||||
"Designer");
|
||||
|
||||
actor.Tell(envelope);
|
||||
|
||||
var response = ExpectMsg<ManagementSuccess>(TimeSpan.FromSeconds(5));
|
||||
Assert.Equal(envelope.CorrelationId, response.CorrelationId);
|
||||
Assert.NotNull(added);
|
||||
Assert.Equal(Commons.Types.Enums.NotificationType.Sms, added!.Type);
|
||||
Assert.Equal(2, added.Recipients.Count);
|
||||
Assert.All(added.Recipients, r =>
|
||||
{
|
||||
Assert.Null(r.EmailAddress);
|
||||
Assert.NotNull(r.PhoneNumber);
|
||||
});
|
||||
Assert.Equal(new[] { "+15551230000", "+15551230001" },
|
||||
added.Recipients.Select(r => r.PhoneNumber).ToArray());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CreateNotificationList_DefaultType_IsEmail()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user