-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: or-2334 make distinction between messages and commands
- Loading branch information
Showing
15 changed files
with
58 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/AssociationRegistry.Admin.Api/Infrastructure/ResponseWriter/ResponseWriter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
src/AssociationRegistry.Admin.Api/Infrastructure/Sequence/SequenceGuarder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/AssociationRegistry.Admin.Api/Infrastructure/Validation/FluentValidatorExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...ciationRegistry.Admin.Api/MessageHandling/Postgres/Dubbels/VoegDubbelToeMessageHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace AssociationRegistry.Admin.Api.MessageHandling.Postgres.Dubbels; | ||
|
||
using Messages; | ||
using Wolverine; | ||
|
||
public class VoegDubbelToeMessageHandler(IMessageBus messageBus) | ||
{ | ||
public async Task Handle(VoegDubbelToeMessage message, CancellationToken cancellationToken) | ||
{ | ||
var command = message.ToCommand(); | ||
|
||
await messageBus.InvokeAsync(command, cancellationToken); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...reer/MetRechtspersoonlijkheid/RequestModels/RegistreerVerenigingUitKboRequestValidator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/AssociationRegistry/Acties/MarkeerAlsDubbelVan/MarkeerAlsDubbelVanCommandHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/AssociationRegistry/Acties/VoegDubbelToe/VoegDubbelToeCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
namespace AssociationRegistry.Acties.VoegDubbelToe; | ||
|
||
using Vereniging; | ||
|
||
public record VoegDubbelToeCommand(VCode VCode, VCode VCodeDubbeleVereniging); |
16 changes: 8 additions & 8 deletions
16
...ry/Dubbels/VoegDubbelToeMessageHandler.cs → ...gDubbelToe/VoegDubbelToeCommandHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace AssociationRegistry.Messages; | ||
|
||
using AssociationRegistry.Acties.VoegDubbelToe; | ||
using AssociationRegistry.Vereniging; | ||
|
||
public record VoegDubbelToeMessage(VCode VCode, VCode VCodeDubbeleVereniging) | ||
{ | ||
public VoegDubbelToeCommand ToCommand() | ||
=> new(VCode, VCodeDubbeleVereniging); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
...elToe/Given_Valid_VoegDubbelToeMessage.cs → ...elToe/Given_Valid_VoegDubbelToeCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
namespace AssociationRegistry.Test.WhenVoegDubbelToe; | ||
|
||
using Acties.VoegDubbelToe; | ||
using AutoFixture; | ||
using Common.AutoFixture; | ||
using Common.Framework; | ||
using Common.Scenarios.CommandHandling; | ||
using Dubbels; | ||
using Events; | ||
using Xunit; | ||
|
||
public class Given_Valid_VoegDubbelToeMessage | ||
public class Given_Valid_VoegDubbelToeCommand | ||
{ | ||
[Fact] | ||
public async Task Then_Throws_InvalidOperationVerenigingKanGeenDubbelWordenVanZichzelf() | ||
{ | ||
var fixture = new Fixture().CustomizeDomain(); | ||
var scenario = new FeitelijkeVerenigingWerdGeregistreerdScenario(); | ||
var repositoryMock = new VerenigingRepositoryMock(scenario.GetVerenigingState()); | ||
var message = fixture.Create<VoegDubbelToeMessage>() | ||
var command = fixture.Create<VoegDubbelToeCommand>() | ||
with | ||
{ | ||
VCode = scenario.VCode, | ||
}; | ||
var sut = new VoegDubbelToeMessageHandler(repositoryMock); | ||
var sut = new VoegDubbelToeCommandHandler(repositoryMock); | ||
|
||
await sut.Handle(message, CancellationToken.None); | ||
await sut.Handle(command, CancellationToken.None); | ||
|
||
repositoryMock.ShouldHaveSaved(new VerenigingWerdToegevoegdAlsDubbel(scenario.VCode, message.VCodeDubbeleVereniging)); | ||
repositoryMock.ShouldHaveSaved(new VerenigingWerdToegevoegdAlsDubbel(scenario.VCode, command.VCodeDubbeleVereniging)); | ||
} | ||
} |