Completed refactor

This commit is contained in:
Khwezi Mngoma
2026-05-14 01:33:21 +02:00
parent 42001998d6
commit 134d8429c0
129 changed files with 1870 additions and 3165 deletions
@@ -1,19 +1,35 @@
using LiteCharms.Features.Notifications.Commands;
using LiteCharms.Features.Shop.Notifications;
namespace LiteCharms.Features.Tests;
public class NotificationsFeatureTests(CommonFixture fixture) : IClassFixture<CommonFixture>
public class NotificationsFeatureTests(CommonFixture fixture, ITestOutputHelper output) : IClassFixture<CommonFixture>
{
private readonly NotificationService notificationService = fixture.Services.GetRequiredService<NotificationService>();
[Fact]
public async Task CreateNotificationCommand_ShouldSucceed()
{
var command = CreateNotification.Create(Models.NotificationDirection.Outgoing, "UnitTest", "khwezi@mngoma.co.za",
"CreateNotificationCommand_ShouldSucceed Test", "Test Message", Models.NotificationPlatforms.Email, Models.Priorities.Medium,
"Khngisa Shop - Test", "shop@litecharms.co.za", Guid.NewGuid().ToString(), Models.CorrelationIdTypes.None,
true, false);
Shop.Notifications.Models.CreateNotification request = new()
{
CorrelationId = Guid.CreateVersion7().ToString(),
CorrelationIdType = Shop.CorrelationIdTypes.None,
Direction = Shop.NotificationDirection.Outgoing,
Platform = Shop.NotificationPlatforms.Email,
Priority = Shop.Priorities.Medium,
Sender = "xUnit Test",
SenderAddress = "khwezi@mngoma.africa",
Recipient = $"{Email.Extensions.Constants.ShopEmailFromName} [Test]",
RecipientAddress = Email.Extensions.Constants.ShopEmailFromAddress,
Subject = "Test Message",
Message = "This is an automation test",
IsHtml = false,
IsInternal = true,
};
var result = await fixture.Mediator.Send(command);
var createResult = await notificationService.CreateNotificationAsync(request);
Assert.True(result.IsSuccess);
Assert.True(createResult.IsSuccess);
foreach (var error in createResult.Errors) output.WriteLine(error.Message);
}
}