-
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.
Merge branch 'main' into or-1349-scripts
- Loading branch information
Showing
24 changed files
with
215 additions
and
83 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
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
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
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
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
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
78 changes: 78 additions & 0 deletions
78
...soonlijkheid/When_RegistreerVerenigingMetRechtspersoonlijkheid/With_Duplicate_Requests.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,78 @@ | ||
namespace AssociationRegistry.Test.Admin.Api.VerenigingMetRechtspersoonlijkheid.When_RegistreerVerenigingMetRechtspersoonlijkheid; | ||
|
||
using AssociationRegistry.Admin.Api.Verenigingen.Registreer.MetRechtspersoonlijkheid.RequestModels; | ||
using AutoFixture; | ||
using Events; | ||
using Fixtures; | ||
using FluentAssertions; | ||
using Framework; | ||
using System.Net; | ||
using Vereniging; | ||
using Xunit; | ||
using Xunit.Categories; | ||
|
||
public sealed class When_RegistreerVerenigingMetRechtspersoonlijkheid_With_Duplicate_Requests | ||
{ | ||
private static When_RegistreerVerenigingMetRechtspersoonlijkheid_With_Duplicate_Requests? called; | ||
public readonly RegistreerVerenigingUitKboRequest UitKboRequest; | ||
public readonly List<Tuple<Task<HttpResponseMessage>, Task<HttpResponseMessage>>> Responses; | ||
|
||
private When_RegistreerVerenigingMetRechtspersoonlijkheid_With_Duplicate_Requests(EventsInDbScenariosFixture fixture) | ||
{ | ||
var autofixture = new Fixture().CustomizeAdminApi(); | ||
|
||
UitKboRequest = new RegistreerVerenigingUitKboRequest | ||
{ | ||
KboNummer = fixture.V020VerenigingMetRechtspersoonlijkheidWerdGeregistreerdForDuplicateDetection | ||
.VerenigingMetRechtspersoonlijkheidWerdGeregistreerd.KboNummer, | ||
}; | ||
|
||
Responses = new List<Tuple<Task<HttpResponseMessage>, Task<HttpResponseMessage>>>(); | ||
|
||
foreach (var kboNummer in autofixture.CreateMany<KboNummer>(5)) | ||
{ | ||
var request = new RegistreerVerenigingUitKboRequest { KboNummer = kboNummer }; | ||
|
||
Responses.Add(new Tuple<Task<HttpResponseMessage>, Task<HttpResponseMessage>>( | ||
fixture.DefaultClient.RegistreerKboVereniging(GetJsonBody(request)), | ||
fixture.DefaultClient.RegistreerKboVereniging(GetJsonBody(request)))); | ||
} | ||
} | ||
|
||
public static When_RegistreerVerenigingMetRechtspersoonlijkheid_With_Duplicate_Requests Called(EventsInDbScenariosFixture fixture) | ||
=> called ??= new When_RegistreerVerenigingMetRechtspersoonlijkheid_With_Duplicate_Requests(fixture); | ||
|
||
private string GetJsonBody(RegistreerVerenigingUitKboRequest uitKboRequest) | ||
=> GetType() | ||
.GetAssociatedResourceJson("files.request.with_kboNummer") | ||
.Replace(oldValue: "{{kboNummer}}", uitKboRequest.KboNummer); | ||
} | ||
|
||
[Collection(nameof(AdminApiCollection))] | ||
[Category("AdminApi")] | ||
[IntegrationTest] | ||
public class With_Duplicate_Requests | ||
{ | ||
private readonly EventsInDbScenariosFixture _fixture; | ||
|
||
public With_Duplicate_Requests(EventsInDbScenariosFixture fixture) | ||
{ | ||
_fixture = fixture; | ||
} | ||
|
||
private RegistreerVerenigingUitKboRequest Request | ||
=> When_RegistreerVerenigingMetRechtspersoonlijkheid_With_Duplicate_Requests.Called(_fixture).UitKboRequest; | ||
|
||
|
||
[Fact] | ||
public async Task Then_it_returns_an_ok_response_with_correct_headers() | ||
{ | ||
var responses = When_RegistreerVerenigingMetRechtspersoonlijkheid_With_Duplicate_Requests.Called(_fixture).Responses; | ||
|
||
foreach (var responseTuple in responses) | ||
{ | ||
var httpResponseMessages = await Task.WhenAll(responseTuple.Item1, responseTuple.Item2); | ||
httpResponseMessages.Count(x => x.StatusCode == HttpStatusCode.Accepted).Should().Be(1); | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.