diff --git a/src/StreetNameRegistry.Api.BackOffice/StreetNameController-ProposeForMunicipalityMerger.cs b/src/StreetNameRegistry.Api.BackOffice/StreetNameController-ProposeForMunicipalityMerger.cs index 649da30c0..cf9f169fa 100644 --- a/src/StreetNameRegistry.Api.BackOffice/StreetNameController-ProposeForMunicipalityMerger.cs +++ b/src/StreetNameRegistry.Api.BackOffice/StreetNameController-ProposeForMunicipalityMerger.cs @@ -85,7 +85,7 @@ public async Task ProposeForMunicipalityMerger( recordNr++; var oldNisCode = csv.GetField("OUD NIS code"); - var oldStreetNamePuri = csv.GetField("OUD straatnaamid"); + var oldStreetNamePersistentLocalIdAsString = csv.GetField("OUD straatnaamid"); var newNisCode = csv.GetField("NIEUW NIS code"); var streetName = csv.GetField("NIEUW straatnaam"); var homonymAddition = csv.GetField("NIEUW homoniemtoevoeging"); @@ -93,13 +93,11 @@ public async Task ProposeForMunicipalityMerger( if (string.IsNullOrWhiteSpace(oldNisCode)) return BadRequest($"OldNisCode is required at record number {recordNr}"); - if (string.IsNullOrWhiteSpace(oldStreetNamePuri)) - return BadRequest($"OldStreetNamePuri is required at record number {recordNr}"); - - if (!OsloPuriValidator.TryParseIdentifier(oldStreetNamePuri, out var oldStreetNamePersistentLocalIdAsString) - || !int.TryParse(oldStreetNamePersistentLocalIdAsString, out var oldStreetNamePersistentLocalId)) - return BadRequest($"OldStreetNamePuri is NaN at record number {recordNr}"); + if (string.IsNullOrWhiteSpace(oldStreetNamePersistentLocalIdAsString)) + return BadRequest($"OldStreetNamePersistentLocalId is required at record number {recordNr}"); + if (!int.TryParse(oldStreetNamePersistentLocalIdAsString, out var oldStreetNamePersistentLocalId)) + return BadRequest($"OldStreetNamePersistentLocalId is NaN at record number {recordNr}"); if (string.IsNullOrWhiteSpace(newNisCode)) return BadRequest($"NisCode is required at record number {recordNr}"); diff --git a/test/StreetNameRegistry.Tests/BackOffice/Api/WhenProposingStreetNameForMunicipalityMerger/GivenMunicipalityExists.cs b/test/StreetNameRegistry.Tests/BackOffice/Api/WhenProposingStreetNameForMunicipalityMerger/GivenMunicipalityExists.cs index 7b97ba339..ac214eb28 100644 --- a/test/StreetNameRegistry.Tests/BackOffice/Api/WhenProposingStreetNameForMunicipalityMerger/GivenMunicipalityExists.cs +++ b/test/StreetNameRegistry.Tests/BackOffice/Api/WhenProposingStreetNameForMunicipalityMerger/GivenMunicipalityExists.cs @@ -62,7 +62,7 @@ public void WithNoNisCode_ThenReturnsBadRequest() var result = Controller.ProposeForMunicipalityMerger( CsvHelpers.CreateFormFileFromString("OUD NIS code;OUD straatnaamid;NIEUW NIS code;NIEUW straatnaam;NIEUW homoniemtoevoeging\n" + - "11001;http://b/123;;Name;HO"), + "11001;123;;Name;HO"), "bla", Mock.Of(), _municipalityConsumerContext, @@ -79,7 +79,7 @@ public void WithDifferentNisCodeThanRoute_ThenReturnsBadRequest() var result = Controller.ProposeForMunicipalityMerger( CsvHelpers.CreateFormFileFromString("OUD NIS code;OUD straatnaamid;NIEUW NIS code;NIEUW straatnaam;NIEUW homoniemtoevoeging\n" + - "11000;http://b/123;11001;Name;HO"), + "11000;123;11001;Name;HO"), nisCode, Mock.Of(), _municipalityConsumerContext, @@ -95,7 +95,7 @@ public void WithNoStreetName_ThenReturnsBadRequest() var result = Controller.ProposeForMunicipalityMerger( CsvHelpers.CreateFormFileFromString("OUD NIS code;OUD straatnaamid;NIEUW NIS code;NIEUW straatnaam;NIEUW homoniemtoevoeging\n" + - "11000;http://b/123;NisCode;;HO"), + "11000;123;NisCode;;HO"), "NisCode", Mock.Of(), _municipalityConsumerContext, @@ -128,7 +128,7 @@ public void WithValidCsv_ThenReturnsOk() var result = Controller.ProposeForMunicipalityMerger( CsvHelpers.CreateFormFileFromString($"OUD NIS code;OUD straatnaamid;NIEUW NIS code;NIEUW straatnaam;NIEUW homoniemtoevoeging\n" + - $"{oldNisCode};http://a/123;11001;Street;HO\n{oldNisCode};http://a/456;11001;Name;NYM\n{oldNisCode};http://a/789;11001;Street;HO"), + $"{oldNisCode};123;11001;Street;HO\n{oldNisCode};456;11001;Name;NYM\n{oldNisCode};789;11001;Street;HO"), "11001", mockPersistentLocalIdGenerator.Object, _municipalityConsumerContext, diff --git a/test/StreetNameRegistry.Tests/CsvHelpers.cs b/test/StreetNameRegistry.Tests/CsvHelpers.cs index a95bf9436..88bf2f77d 100644 --- a/test/StreetNameRegistry.Tests/CsvHelpers.cs +++ b/test/StreetNameRegistry.Tests/CsvHelpers.cs @@ -7,7 +7,7 @@ public sealed class CsvHelpers { public const string OldNisCode = "11000"; - public const string Example = $"OUD NIS code;OUD straatnaamid;NIEUW NIS code;NIEUW straatnaam;NIEUW homoniemtoevoeging\n{OldNisCode};http://v/a/123;11001;naam;BB"; + public const string Example = $"OUD NIS code;OUD straatnaamid;NIEUW NIS code;NIEUW straatnaam;NIEUW homoniemtoevoeging\n{OldNisCode};123;11001;naam;BB"; //Convert the string to be able to passed as IFormFile public static IFormFile CreateFormFileFromString(string content, string fileName = "file.csv")