diff --git a/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Notifications/NotificationLists.razor b/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Notifications/NotificationLists.razor index b4ba8940..e8b1110f 100644 --- a/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Notifications/NotificationLists.razor +++ b/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Notifications/NotificationLists.razor @@ -45,6 +45,7 @@ Name + Type Recipients Actions @@ -56,6 +57,7 @@ ?? (IReadOnlyList)Array.Empty(); @list.Name + @list.Type @if (recipients.Count == 0) { diff --git a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Pages/NotificationListsPageTests.cs b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Pages/NotificationListsPageTests.cs index 54e3f0ef..3ae97705 100644 --- a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Pages/NotificationListsPageTests.cs +++ b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Pages/NotificationListsPageTests.cs @@ -7,6 +7,7 @@ using NSubstitute; using ZB.MOM.WW.ScadaBridge.CentralUI.Components.Shared; using ZB.MOM.WW.ScadaBridge.Commons.Entities.Notifications; using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Repositories; +using ZB.MOM.WW.ScadaBridge.Commons.Types.Enums; using NotificationListsPage = ZB.MOM.WW.ScadaBridge.CentralUI.Components.Pages.Notifications.NotificationLists; namespace ZB.MOM.WW.ScadaBridge.CentralUI.Tests.Pages; @@ -98,6 +99,56 @@ public class NotificationListsPageTests : BunitContext }); } + [Fact] + public void RendersTypeColumn_Sms() + { + var repo = Substitute.For(); + repo.GetAllNotificationListsAsync() + .Returns(Task.FromResult>( + new List + { + new("SMS Alerts") { Id = 2, Type = NotificationType.Sms } + })); + repo.GetRecipientsByListIdAsync(2) + .Returns(Task.FromResult>( + new List())); + Services.AddSingleton(repo); + WireAuthAndDialog(); + + var cut = Render(); + + cut.WaitForAssertion(() => + { + Assert.Contains("SMS Alerts", cut.Markup); + Assert.Contains("Sms", cut.Markup); + }); + } + + [Fact] + public void RendersTypeColumn_Email() + { + var repo = Substitute.For(); + repo.GetAllNotificationListsAsync() + .Returns(Task.FromResult>( + new List + { + new("Email Alerts") { Id = 3, Type = NotificationType.Email } + })); + repo.GetRecipientsByListIdAsync(3) + .Returns(Task.FromResult>( + new List())); + Services.AddSingleton(repo); + WireAuthAndDialog(); + + var cut = Render(); + + cut.WaitForAssertion(() => + { + Assert.Contains("Email Alerts", cut.Markup); + Assert.Contains("Email", cut.Markup); + }); + } + /// A dialog service that auto-confirms, so action paths run end-to-end. private sealed class AlwaysConfirmDialogService : IDialogService {