-
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.
feat: or-2189 laatste vertegenwoordiger mag niet verwijderd worden
- Loading branch information
Showing
6 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
src/AssociationRegistry/Resources/ExceptionMessages.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
16 changes: 16 additions & 0 deletions
16
...reniging/Vertegenwoordigers/Exceptions/LaatsteVertegenwoordigerKanNietVerwijderdWorden.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,16 @@ | ||
namespace AssociationRegistry.Vereniging.Exceptions; | ||
|
||
using Be.Vlaanderen.Basisregisters.AggregateSource; | ||
using System.Runtime.Serialization; | ||
|
||
[Serializable] | ||
public class LaatsteVertegenwoordigerKanNietVerwijderdWorden : DomainException | ||
{ | ||
public LaatsteVertegenwoordigerKanNietVerwijderdWorden() : base(ExceptionMessages.LaatsteVertegenwoordigerKanNietVerwijderdWorden) | ||
{ | ||
} | ||
|
||
protected LaatsteVertegenwoordigerKanNietVerwijderdWorden(SerializationInfo info, StreamingContext context) : base(info, context) | ||
{ | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...eVereniging/When_Removing_Vertegenwoordiger/CommandHandling/With_One_Vertegenwoordiger.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,39 @@ | ||
namespace AssociationRegistry.Test.Admin.Api.FeitelijkeVereniging.When_Removing_Vertegenwoordiger.CommandHandling; | ||
|
||
using Acties.VerwijderVertegenwoordiger; | ||
using AssociationRegistry.Framework; | ||
using AutoFixture; | ||
using Fakes; | ||
using Fixtures.Scenarios.CommandHandling; | ||
using Framework; | ||
using Vereniging; | ||
using Vereniging.Exceptions; | ||
using Xunit; | ||
using Xunit.Categories; | ||
|
||
[UnitTest] | ||
public class With_One_Vertegenwoordiger | ||
{ | ||
private readonly VerenigingRepositoryMock _verenigingRepositoryMock; | ||
private readonly FeitelijkeVerenigingWerdGeregistreerdWithOneVertegenwoordigerScenario _scenario; | ||
private readonly Fixture _fixture; | ||
|
||
public With_One_Vertegenwoordiger() | ||
{ | ||
_scenario = new FeitelijkeVerenigingWerdGeregistreerdWithOneVertegenwoordigerScenario(); | ||
_verenigingRepositoryMock = new VerenigingRepositoryMock(_scenario.GetVerenigingState()); | ||
_fixture = new Fixture().CustomizeAdminApi(); | ||
} | ||
|
||
[Fact] | ||
public async Task Then_Throws_LaatsteVertegenwoordigerKanNietVerwijderdWordenException() | ||
{ | ||
var command = new VerwijderVertegenwoordigerCommand(_scenario.VCode, _scenario.VertegenwoordigerId); | ||
var commandMetadata = _fixture.Create<CommandMetadata>(); | ||
var commandHandler = new VerwijderVertegenwoordigerCommandHandler(_verenigingRepositoryMock); | ||
await Assert.ThrowsAsync<LaatsteVertegenwoordigerKanNietVerwijderdWorden>(async () => await commandHandler.Handle( | ||
new CommandEnvelope<VerwijderVertegenwoordigerCommand>( | ||
command, commandMetadata), | ||
CancellationToken.None)); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
.../CommandHandling/FeitelijkeVerenigingWerdGeregistreerdWithOneVertegenwoordigerScenario.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,34 @@ | ||
namespace AssociationRegistry.Test.Admin.Api.Fixtures.Scenarios.CommandHandling; | ||
|
||
using AssociationRegistry.Framework; | ||
using AutoFixture; | ||
using Events; | ||
using Framework; | ||
using Vereniging; | ||
|
||
public class FeitelijkeVerenigingWerdGeregistreerdWithOneVertegenwoordigerScenario : CommandhandlerScenarioBase | ||
{ | ||
public FeitelijkeVerenigingWerdGeregistreerdWithOneVertegenwoordigerScenario() | ||
{ | ||
var fixture = new Fixture().CustomizeAdminApi(); | ||
VCode = fixture.Create<VCode>(); | ||
FeitelijkeVerenigingWerdGeregistreerd = fixture.Create<FeitelijkeVerenigingWerdGeregistreerd>() with | ||
{ | ||
VCode = VCode, | ||
Vertegenwoordigers = new []{fixture.Create<Registratiedata.Vertegenwoordiger>()} | ||
}; | ||
|
||
VertegenwoordigerId = FeitelijkeVerenigingWerdGeregistreerd.Vertegenwoordigers.First().VertegenwoordigerId; | ||
} | ||
|
||
public override VCode VCode { get; } | ||
public FeitelijkeVerenigingWerdGeregistreerd FeitelijkeVerenigingWerdGeregistreerd { get; } | ||
public int VertegenwoordigerId { get; } | ||
public override IEnumerable<IEvent> Events() | ||
{ | ||
return new IEvent[] | ||
{ | ||
FeitelijkeVerenigingWerdGeregistreerd, | ||
}; | ||
} | ||
} |