diff --git a/test/OrganisationRegistry.UnitTests/Organisation/Kbo/CoupleOrganisationToKboTests.cs b/test/OrganisationRegistry.UnitTests/Organisation/Kbo/CoupleOrganisationToKboTests.cs index a818d0749..d68f5a9d5 100755 --- a/test/OrganisationRegistry.UnitTests/Organisation/Kbo/CoupleOrganisationToKboTests.cs +++ b/test/OrganisationRegistry.UnitTests/Organisation/Kbo/CoupleOrganisationToKboTests.cs @@ -4,6 +4,8 @@ namespace OrganisationRegistry.UnitTests.Organisation.Kbo; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Api.Infrastructure.Magda; +using ElasticSearch.Organisations; using FluentAssertions; using Infrastructure.Tests.Extensions.TestHelpers; using OrganisationRegistry.KeyTypes.Events; @@ -282,6 +284,21 @@ await Given(Events) organisationLabelAdded.ValidTo.Should().Be(new ValidTo()); } + [Fact] + public async Task AddsLegalEntityType() + { + await Given(Events) + .When(CoupleOrganisationToKboCommand, TestUser.AlgemeenBeheerder) + .Then(); + + var organisationLabelAdded = PublishedEvents.Where(evt=>evt.Body is KboLegalEntityTypeAdded).ToList()[0].UnwrapBody(); + organisationLabelAdded.Should().NotBeNull(); + + organisationLabelAdded.OrganisationId.Should().Be(_organisationId); + organisationLabelAdded.LegalEntityTypeCode.Should().Be(MockMagdaOrganisationResponse.MockLegalEntityTypeCode); + organisationLabelAdded.LegalEntityTypeDescription.Should().Be(MockMagdaOrganisationResponse.MockLegalEntityType); + } + [Fact] public async Task PublishesTheCorrectNumberOfEvents() => await Given(Events) diff --git a/test/OrganisationRegistry.UnitTests/Organisation/Kbo/CreateOrganisationFromKboTests.cs b/test/OrganisationRegistry.UnitTests/Organisation/Kbo/CreateOrganisationFromKboTests.cs index 467c8cdf0..be524ed14 100755 --- a/test/OrganisationRegistry.UnitTests/Organisation/Kbo/CreateOrganisationFromKboTests.cs +++ b/test/OrganisationRegistry.UnitTests/Organisation/Kbo/CreateOrganisationFromKboTests.cs @@ -330,8 +330,8 @@ await Given(Events) organisationLabelAdded.Should().NotBeNull(); organisationLabelAdded.OrganisationId.Should().Be(_organisationId); - organisationLabelAdded.LegalEntityTypeCode.Should().Be("1"); - organisationLabelAdded.LegalEntityTypeDescription.Should().Be("Natuurlijke Persoon"); + organisationLabelAdded.LegalEntityTypeCode.Should().Be(MockMagdaOrganisationResponse.MockLegalEntityTypeCode); + organisationLabelAdded.LegalEntityTypeDescription.Should().Be(MockMagdaOrganisationResponse.MockLegalEntityType); } [Fact] diff --git a/test/OrganisationRegistry.UnitTests/Organisation/Kbo/MockMagdaOrganisationResponse.cs b/test/OrganisationRegistry.UnitTests/Organisation/Kbo/MockMagdaOrganisationResponse.cs index 8f31ff905..eb7beeaea 100755 --- a/test/OrganisationRegistry.UnitTests/Organisation/Kbo/MockMagdaOrganisationResponse.cs +++ b/test/OrganisationRegistry.UnitTests/Organisation/Kbo/MockMagdaOrganisationResponse.cs @@ -7,6 +7,8 @@ namespace OrganisationRegistry.UnitTests.Organisation.Kbo; public class MockMagdaOrganisationResponse : IMagdaOrganisationResponse { + public const string MockLegalEntityType = "Natuurlijke Persoon"; + public const string MockLegalEntityTypeCode = "1"; public IMagdaName FormalName { get; set; } = null!; public IMagdaName ShortName { get; set; } = null!; public DateTime? ValidFrom { get; set; } @@ -19,7 +21,7 @@ public class MockMagdaOrganisationResponse : IMagdaOrganisationResponse public MockMagdaOrganisationResponse() { - LegalEntityType = new MagdaLegalEntityType("1", "Natuurlijke Persoon"); + LegalEntityType = new MagdaLegalEntityType(MockLegalEntityTypeCode, MockLegalEntityType); BankAccounts = new List(); } } diff --git a/test/OrganisationRegistry.UnitTests/Organisation/Kbo/UpdateFromKboTests.cs b/test/OrganisationRegistry.UnitTests/Organisation/Kbo/UpdateFromKboTests.cs index 91032879a..c4c2b81a7 100644 --- a/test/OrganisationRegistry.UnitTests/Organisation/Kbo/UpdateFromKboTests.cs +++ b/test/OrganisationRegistry.UnitTests/Organisation/Kbo/UpdateFromKboTests.cs @@ -217,10 +217,10 @@ protected override KboOrganisationCommandHandlers BuildHandler(ISession session) [Fact] - public async Task PublishesElevenEvents() + public async Task PublishesTheCorrectNumberOfEvents() { await Given(Events).When(SyncOrganisationWithKboCommand, TestUser.AlgemeenBeheerder) - .ThenItPublishesTheCorrectNumberOfEvents(12); + .ThenItPublishesTheCorrectNumberOfEvents(11); } [Fact]