-
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-2335 implement retry mechanism for weigering dubbel
- Loading branch information
Showing
7 changed files
with
115 additions
and
9 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
21 changes: 21 additions & 0 deletions
21
...Registry/Notifications/Messages/VerwerkWeigeringDubbelDoorAuthentiekeVerenigingGefaald.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,21 @@ | ||
namespace AssociationRegistry.Notifications.Messages; | ||
|
||
using Notifications; | ||
using Vereniging; | ||
|
||
public class VerwerkWeigeringDubbelDoorAuthentiekeVerenigingGefaald : IMessage | ||
{ | ||
private readonly Exception _exception; | ||
private readonly VCode _vCode; | ||
private readonly VCode _authentiekeVerenging; | ||
|
||
public VerwerkWeigeringDubbelDoorAuthentiekeVerenigingGefaald(Exception exception, VCode vCode, VCode authentiekeVerenging) | ||
{ | ||
_exception = exception; | ||
_vCode = vCode; | ||
_authentiekeVerenging = authentiekeVerenging; | ||
} | ||
|
||
public string Value => $"Dubbel ({_vCode}) werd geweigerd door authentieke vereniging({_authentiekeVerenging}): {_exception.Message}."; | ||
public NotifyType Type => NotifyType.Failure; | ||
} |
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
37 changes: 37 additions & 0 deletions
37
...t/Dubbels/When_Verwerk_Weigering_Dubbel_Door_Authentieke_Vereniging/Given_An_Exception.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,37 @@ | ||
namespace AssociationRegistry.Test.Dubbels.When_Verwerk_Weigering_Dubbel_Door_Authentieke_Vereniging; | ||
|
||
using Acties.VerwerkWeigeringDubbelDoorAuthentiekeVereniging; | ||
using Common.Scenarios.CommandHandling; | ||
using Microsoft.Extensions.Logging.Abstractions; | ||
using Moq; | ||
using Notifications; | ||
using Notifications.Messages; | ||
using Vereniging; | ||
using Xunit; | ||
|
||
public class Given_An_Exception | ||
{ | ||
[Fact] | ||
public async Task Then_It_Retries() | ||
{ | ||
var scenario = new VerenigingWerdGemarkeerdAlsDubbelVanScenario(); | ||
var repositoryMock = new Mock<IVerenigingsRepository>(); | ||
var notifier = new Mock<INotifier>(); | ||
var vCodeAuthentiekeVereniging = VCode.Create(scenario.VerenigingWerdGemarkeerdAlsDubbelVan.VCodeAuthentiekeVereniging); | ||
|
||
var command = new VerwerkWeigeringDubbelDoorAuthentiekeVerenigingCommand( | ||
VCode: scenario.VCode, | ||
VCodeAuthentiekeVereniging: vCodeAuthentiekeVereniging); | ||
|
||
var sut = new VerwerkWeigeringDubbelDoorAuthentiekeVerenigingCommandHandler( | ||
repositoryMock.Object, | ||
notifier.Object, | ||
new NullLogger<VerwerkWeigeringDubbelDoorAuthentiekeVerenigingCommandHandler>()); | ||
|
||
// ignore the assert throw, only interested in the veryfies | ||
await Assert.ThrowsAsync<NullReferenceException>(async () => await sut.Handle(command, CancellationToken.None)); | ||
|
||
repositoryMock.Verify(x => x.Load<Vereniging>(It.IsAny<VCode>(), It.IsAny<int?>(), true, true), times: Times.Exactly(5)); | ||
notifier.Verify(x => x.Notify(It.IsAny<VerwerkWeigeringDubbelDoorAuthentiekeVerenigingGefaald>()), times: Times.Exactly(4)); | ||
} | ||
} |
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