-
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.
fix: or-1821 fix identificator nullref on get address adresmatch
- Loading branch information
Showing
7 changed files
with
147 additions
and
2 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
32 changes: 32 additions & 0 deletions
32
...try.Test.Admin.Api/Grar/When_Address_Match/Fixtures/WithNoIdInMatchDestelbergenFixture.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,32 @@ | ||
namespace AssociationRegistry.Test.Admin.Api.Grar.When_Address_Match.Fixtures; | ||
|
||
using AssociationRegistry.Grar; | ||
using AssociationRegistry.Grar.Models; | ||
using Microsoft.Extensions.Logging.Abstractions; | ||
using Xunit; | ||
|
||
public class WithNoIdInMatchDestelbergenFixture : IAsyncLifetime | ||
{ | ||
private readonly GrarClient _client; | ||
public string Straatnaam = "Dendermondsesteenweg"; | ||
public string Huisnummer = "32747"; | ||
public string Gemeentenaam = "Destelbergen"; | ||
public string Postcode = "9070"; | ||
|
||
public WithNoIdInMatchDestelbergenFixture() | ||
{ | ||
_client = new GrarClient(new GrarHttpClient(new HttpClient() | ||
{ | ||
BaseAddress = new Uri("http://localhost:8080/") | ||
}), NullLogger<GrarClient>.Instance); | ||
} | ||
|
||
public IReadOnlyCollection<AddressMatchResponse> Result { get; private set; } | ||
|
||
public async Task InitializeAsync() | ||
{ | ||
Result = await _client.GetAddress(Straatnaam, Huisnummer, null, Postcode, Gemeentenaam); | ||
} | ||
|
||
public Task DisposeAsync() => Task.CompletedTask; | ||
} |
23 changes: 23 additions & 0 deletions
23
...iationRegistry.Test.Admin.Api/Grar/When_Address_Match/With_No_Id_In_Match_Destelbergen.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,23 @@ | ||
namespace AssociationRegistry.Test.Admin.Api.Grar.When_Address_Match; | ||
|
||
using Fixtures; | ||
using FluentAssertions; | ||
using Xunit; | ||
using Xunit.Categories; | ||
|
||
[UnitTest] | ||
public class With_No_Id_In_Match_Destelbergen : IClassFixture<WithNoIdInMatchDestelbergenFixture> | ||
{ | ||
private readonly WithNoIdInMatchDestelbergenFixture _fixture; | ||
|
||
public With_No_Id_In_Match_Destelbergen(WithNoIdInMatchDestelbergenFixture fixture) | ||
{ | ||
_fixture = fixture; | ||
} | ||
|
||
[Fact] | ||
public void Then_It_Returns_No_Matches() | ||
{ | ||
_fixture.Result.Should().BeEmpty(); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...sociationRegistry.Test/When_ProbeerAdresTeMatchen/Given_GrarClient_Returned_No_Matches.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,40 @@ | ||
namespace AssociationRegistry.Test.When_ProbeerAdresTeMatchen; | ||
|
||
using AutoFixture; | ||
using Events; | ||
using FluentAssertions; | ||
using Framework.Customizations; | ||
using Grar; | ||
using Grar.Models; | ||
using Moq; | ||
using Vereniging; | ||
using Xunit; | ||
|
||
public class Given_GrarClient_Returned_No_Matches | ||
{ | ||
[Fact] | ||
public async Task Then_AdresWerdNietGevondenInAdressenregister() | ||
{ | ||
var fixture = new Fixture().CustomizeDomain(); | ||
|
||
var grarClient = new Mock<IGrarClient>(); | ||
var vereniging = new Vereniging(); | ||
|
||
var feitelijkeVerenigingWerdGeregistreerd = fixture.Create<FeitelijkeVerenigingWerdGeregistreerd>(); | ||
|
||
grarClient.Setup(x => x.GetAddress(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), | ||
It.IsAny<string>())) | ||
.ReturnsAsync(new List<AddressMatchResponse>()); | ||
|
||
vereniging.Hydrate( | ||
new VerenigingState() | ||
.Apply(feitelijkeVerenigingWerdGeregistreerd)); | ||
|
||
await vereniging.ProbeerAdresTeMatchen(grarClient.Object, feitelijkeVerenigingWerdGeregistreerd.Locaties.First().LocatieId); | ||
|
||
var @event = vereniging.UncommittedEvents.OfType<AdresWerdNietGevondenInAdressenregister>().SingleOrDefault(); | ||
|
||
@event.Should().NotBeNull(); | ||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
wiremock/__files/AdresMatch/No_Id_In_Match_Destelbergen.json
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,31 @@ | ||
{ | ||
"@context": "https://docs.basisregisters.staging-vlaanderen.be/context/adresmatch/2023-03-13/adresmatch.jsonld", | ||
"adresMatches": [ | ||
{ | ||
"@type": "Adres", | ||
"gemeente": { | ||
"objectId": "44013", | ||
"detail": "https://api.basisregisters.staging-vlaanderen.be/v2/gemeenten/44013", | ||
"gemeentenaam": { | ||
"geografischeNaam": { | ||
"spelling": "Destelbergen", | ||
"taal": "nl" | ||
} | ||
} | ||
}, | ||
"straatnaam": { | ||
"objectId": "68713", | ||
"detail": "https://api.basisregisters.staging-vlaanderen.be/v2/straatnamen/68713", | ||
"straatnaam": { | ||
"geografischeNaam": { | ||
"spelling": "Dendermondesteenweg", | ||
"taal": "nl" | ||
} | ||
} | ||
}, | ||
"score": 87.9911986967736, | ||
"links": [] | ||
} | ||
], | ||
"warnings": [] | ||
} |
19 changes: 19 additions & 0 deletions
19
wiremock/mappings/AdresMatch.no-id-in-match-Destelbergen.json
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,19 @@ | ||
{ | ||
"priority": 2, | ||
"request": { | ||
"method": "GET", | ||
"urlPath": "/v2/adresmatch", | ||
"queryParameters": { | ||
"Gemeentenaam": { | ||
"equalTo": "Destelbergen" | ||
} | ||
} | ||
}, | ||
"response": { | ||
"status": 200, | ||
"bodyFileName": "AdresMatch/No_Id_In_Match_Destelbergen.json", | ||
"headers": { | ||
"Content-Type": "application/json" | ||
} | ||
} | ||
} |