2025-03-10 18:10:00 +01:00
|
|
|
using Autofac;
|
|
|
|
|
using Insight.Database;
|
|
|
|
|
using PlanTempus.Components;
|
|
|
|
|
using PlanTempus.Components.Users.Create;
|
2025-03-12 00:13:53 +01:00
|
|
|
using PlanTempus.Core.CommandQueries;
|
2025-03-10 18:10:00 +01:00
|
|
|
using PlanTempus.Core.Database;
|
|
|
|
|
using PlanTempus.Core.Database.ConnectionFactory;
|
2025-03-11 00:28:06 +01:00
|
|
|
using Shouldly;
|
2025-03-10 18:10:00 +01:00
|
|
|
namespace PlanTempus.X.TDD.CommandQueryHandlerTests;
|
|
|
|
|
|
|
|
|
|
[TestClass]
|
|
|
|
|
public class HandlerTest : TestFixture
|
|
|
|
|
{
|
|
|
|
|
[TestInitialize]
|
|
|
|
|
public void This()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
2025-03-11 00:28:06 +01:00
|
|
|
public async Task ShouldResolveCommandHandlerAndDispatchToGenericCommandHandler()
|
2025-03-10 18:10:00 +01:00
|
|
|
{
|
2025-03-11 00:28:06 +01:00
|
|
|
var commandHandler = Container.Resolve<ICommandHandler>();
|
|
|
|
|
commandHandler.ShouldBeOfType<CommandHandler>();
|
2025-03-10 18:10:00 +01:00
|
|
|
|
|
|
|
|
var command = new CreateUserCommand
|
|
|
|
|
{
|
2026-01-08 21:51:43 +01:00
|
|
|
Email = $"{GetRandomWord()}@dumbanddumber.com5", // Lloyd Christmas
|
2025-03-10 18:10:00 +01:00
|
|
|
Password = "1234AceVentura#LOL", // Ace Ventura
|
|
|
|
|
IsActive = true,
|
|
|
|
|
CorrelationId = Guid.NewGuid()
|
|
|
|
|
};
|
|
|
|
|
|
2025-03-12 00:13:53 +01:00
|
|
|
var result = await commandHandler.Handle(command);
|
2025-03-11 00:28:06 +01:00
|
|
|
|
|
|
|
|
result.ShouldNotBeNull();
|
2025-03-10 18:10:00 +01:00
|
|
|
}
|
|
|
|
|
}
|