Adds Decorator, wip

This commit is contained in:
Janus C. H. Knudsen 2025-03-11 00:28:06 +01:00
parent a86a2d7ade
commit 49f9b99ee1
9 changed files with 112 additions and 45 deletions

View file

@ -4,6 +4,7 @@ using PlanTempus.Components;
using PlanTempus.Components.Users.Create;
using PlanTempus.Core.Database;
using PlanTempus.Core.Database.ConnectionFactory;
using Shouldly;
namespace PlanTempus.X.TDD.CommandQueryHandlerTests;
@ -16,18 +17,21 @@ public class HandlerTest : TestFixture
}
[TestMethod]
public void TestDefaultConnection()
public async Task ShouldResolveCommandHandlerAndDispatchToGenericCommandHandler()
{
var commandHandler = Container.Resolve<CommandHandler>();
var commandHandler = Container.Resolve<ICommandHandler>();
commandHandler.ShouldBeOfType<CommandHandler>();
var command = new CreateUserCommand
{
Email = "lloyd@dumbanddumber.com", // Lloyd Christmas
Email = "lloyd@dumbanddumber.com1", // Lloyd Christmas
Password = "1234AceVentura#LOL", // Ace Ventura
IsActive = true,
CorrelationId = Guid.NewGuid()
};
var result = commandHandler.Handle<CreateUserCommand, CreateUserResult>(command);
var result = await commandHandler.Handle<CreateUserCommand, CreateUserResult>(command);
result.ShouldNotBeNull();
}
}