Skip to content

Commit

Permalink
feat: or-2353 also add kbo legal entity when syncing
Browse files Browse the repository at this point in the history
  • Loading branch information
koenmetsu committed Sep 17, 2024
1 parent ba0fb8e commit dd0f15c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ private async Task SyncWithKbo(OrganisationId organisationId, IUser user, Guid?

organisation.UpdateKboBankAccount(kboOrganisation.BankAccounts);

organisation.AddKboLegalEntityType(kboOrganisation.LegalEntityType);

if (kboOrganisation.Termination != null)
organisation.MarkTerminationFound(kboOrganisation.Termination);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ protected override KboOrganisationCommandHandlers BuildHandler(ISession session)
public async Task PublishesTheCorrectNumberOfEvents()
{
await Given(Events).When(SyncOrganisationWithKboCommand, TestUser.AlgemeenBeheerder)
.ThenItPublishesTheCorrectNumberOfEvents(11);
.ThenItPublishesTheCorrectNumberOfEvents(12);
}

[Fact]
Expand Down Expand Up @@ -397,7 +397,7 @@ public async Task MarksAsSynced()
{
await Given(Events).When(SyncOrganisationWithKboCommand, TestUser.AlgemeenBeheerder).Then();

var organisationSyncedFromKbo = PublishedEvents[10].UnwrapBody<OrganisationSyncedFromKbo>();
var organisationSyncedFromKbo = PublishedEvents[11].UnwrapBody<OrganisationSyncedFromKbo>();
organisationSyncedFromKbo.Should().NotBeNull();

organisationSyncedFromKbo.OrganisationId.Should().Be(_organisationId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ namespace OrganisationRegistry.UnitTests.Organisation.Kbo;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using ElasticSearch.Organisations;
using FluentAssertions;
using Infrastructure.Tests.Extensions.TestHelpers;
using OrganisationRegistry.KeyTypes.Events;
Expand Down Expand Up @@ -147,6 +148,10 @@ private IEvent[] Events
true,
new DateTime(2000, 1, 1),
new DateTime(2001, 1, 1)),
new KboLegalEntityTypeAdded(
_organisationId,
MockMagdaOrganisationResponse.MockLegalEntityTypeCode,
MockMagdaOrganisationResponse.MockLegalEntityType),
};

private SyncOrganisationWithKbo SyncOrganisationWithKboCommand
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ private IEvent[] Events
"Classificatie",
new ValidFrom(2020, 12, 11),
new ValidTo(2020, 12, 12)),
new KboLegalEntityTypeAdded(
_organisationId,
MockMagdaOrganisationResponse.MockLegalEntityTypeCode,
MockMagdaOrganisationResponse.MockLegalEntityType),
};

private SyncOrganisationWithKbo SyncOrganisationWithKboCommand
Expand Down

0 comments on commit dd0f15c

Please sign in to comment.