diff --git a/src/PostalCodes.UnitTests/CountrySpecificPostalCodes/NLPostalCodeManualTests.cs b/src/PostalCodes.UnitTests/CountrySpecificPostalCodes/NLPostalCodeManualTests.cs index 4acbae6..06284c1 100644 --- a/src/PostalCodes.UnitTests/CountrySpecificPostalCodes/NLPostalCodeManualTests.cs +++ b/src/PostalCodes.UnitTests/CountrySpecificPostalCodes/NLPostalCodeManualTests.cs @@ -6,10 +6,12 @@ namespace PostalCodes.UnitTests.CountrySpecificPostalCodes internal class NLPostalCodeManualTests { [Test] - [TestCase("9992 ZZ", "9991")] + [TestCase("9992 ZZ", "9992ZY")] [TestCase("9992", "9991")] - [TestCase("1000 ZZ", "0999")] - [TestCase("4000 ZZ", "3999")] + [TestCase("1000", "0999")] + [TestCase("1000 AA", "0999ZZ")] + [TestCase("4000 ZZ", "4000ZY")] + [TestCase("4000", "3999")] [TestCase("1422", "1421")] public void Predecessor_ValidInput_ReturnsCorrectPostalCode(string postalCode, string postalCodePredecessor) { @@ -17,18 +19,22 @@ public void Predecessor_ValidInput_ReturnsCorrectPostalCode(string postalCode, s } [Test] - [TestCase("9992 ZZ", "9993")] [TestCase("9992", "9993")] - [TestCase("1000 ZZ", "1001")] - [TestCase("4000 ZZ", "4001")] + [TestCase("9992 ZZ", "9993AA")] + [TestCase("9992", "9993")] + [TestCase("1000", "1001")] + [TestCase("1000 ZZ", "1001AA")] + [TestCase("4000", "4001")] + [TestCase("4000 ZZ", "4001AA")] [TestCase("8999", "9000")] + [TestCase("8999AA", "8999AB")] public void Successor_ValidInput_ReturnsCorrectPostalCode(string postalCode, string postalCodeSuccessor) { Assert.AreEqual(postalCodeSuccessor, (new NLPostalCode(postalCode)).Successor.ToString()); } [Test] - [TestCase("0000 ZZ")] + [TestCase("0000 AA")] [TestCase("0000")] public void Predecessor_FirstInRange_ReturnsNull(string postalCode) { diff --git a/src/PostalCodes.UnitTests/Generated/NLPostalCodeTests.gen.cs b/src/PostalCodes.UnitTests/Generated/NLPostalCodeTests.gen.cs index b9eb184..009e351 100644 --- a/src/PostalCodes.UnitTests/Generated/NLPostalCodeTests.gen.cs +++ b/src/PostalCodes.UnitTests/Generated/NLPostalCodeTests.gen.cs @@ -7,8 +7,10 @@ namespace PostalCodes.UnitTests.Generated internal class NLPostalCodeTests { - [TestCase("9999ZZ","9998")] - [TestCase("1000AA","0999")] + [TestCase("9999","9998")] + [TestCase("1000","0999")] + [TestCase("9999ZZ","9999ZY")] + [TestCase("1000AA","0999ZZ")] public void Predecessor_ValidInput_ReturnsCorrectPostalCode(string postalCode, string postalCodePredecessor) { var code = new NLPostalCode(postalCode); @@ -18,8 +20,10 @@ public void Predecessor_ValidInput_ReturnsCorrectPostalCode(string postalCode, s Assert.AreEqual(codePredecessor.ToHumanReadableString(), code.Predecessor.ToHumanReadableString()); } - [TestCase("0999ZZ","1000")] - [TestCase("3456JT","3457")] + [TestCase("0999","1000")] + [TestCase("3456","3457")] + [TestCase("0999ZZ","1000AA")] + [TestCase("3456JT","3456JU")] public void Successor_ValidInput_ReturnsCorrectPostalCode(string postalCode, string postalCodeSuccessor) { var code = new NLPostalCode(postalCode); @@ -48,6 +52,11 @@ public void InvalidCode_ThrowsArgumentException(string postalCode) Assert.Throws(() => new NLPostalCode(postalCode)); } + [TestCase("1234", "1236")] + [TestCase("1234AA", "1236AA")] + [TestCase("1235", "1237AA")] + [TestCase("1235ZY", "1235ZZ")] + [TestCase("1234ZZ", "1235")] public void CompareTo_ReturnsExpectedSign(string postalCodeBefore, string postalCodeAfter) { var b = new NLPostalCode(postalCodeBefore); diff --git a/src/PostalCodes.UnitTests/PostalCodeFactoryTests.cs b/src/PostalCodes.UnitTests/PostalCodeFactoryTests.cs index 5a34573..fead077 100644 --- a/src/PostalCodes.UnitTests/PostalCodeFactoryTests.cs +++ b/src/PostalCodes.UnitTests/PostalCodeFactoryTests.cs @@ -11,7 +11,8 @@ internal class PostalCodeFactoryTests [TestCase("GB", "A1 9ZZ", "A19ZZ", "GBPostalCode")] // long [TestCase("PT", "0042", "0042", "PTPostalCode")] [TestCase("CA", "A9A9A9", "A9A9A9", "CAPostalCode")] - [TestCase("NL", "0024 ZZ", "0024", "NLPostalCode")] + [TestCase("NL", "0024", "0024", "NLPostalCode")] // short NL + [TestCase("NL", "0024 ZZ", "0024ZZ", "NLPostalCode")] // long NL [TestCase("MT", "PLA1234", "PLA1234", "MTPostalCode")] [TestCase("??", "004", "004", "DefaultPostalCode")] public void CreatePostalCode_ReturnsCorrectObjectType(string country, string postalCode, string normalizedPostalCode, string objectTypeName) diff --git a/src/PostalCodes/Generated/NLPostalCode.gen.cs b/src/PostalCodes/Generated/NLPostalCode.gen.cs index 86aa8e3..bca3de9 100644 --- a/src/PostalCodes/Generated/NLPostalCode.gen.cs +++ b/src/PostalCodes/Generated/NLPostalCode.gen.cs @@ -40,7 +40,7 @@ public override int GetHashCode () RegexShort = new Regex("^[0-9]{4}$", RegexOptions.Compiled), OutputDefault = "xxxx xx", OutputShort = "xxxx", - AutoConvertToShort = true, + AutoConvertToShort = false, ShortExpansionAsLowestInRange = "AA", ShortExpansionAsHighestInRange = "ZZ", LeftPaddingCharacter = "0", diff --git a/src/countries/NL.json b/src/countries/NL.json index ce1bafb..ef1bd15 100644 --- a/src/countries/NL.json +++ b/src/countries/NL.json @@ -14,7 +14,7 @@ "LeftPaddingCharacter" : "0", - "AutoConvertToShort" : "true", + "AutoConvertToShort" : "false", "ShortExpansionAsLowestInRange" : "AA", "ShortExpansionAsHighestInRange" : "ZZ" } @@ -26,13 +26,24 @@ "Valid" : ["1235DF", "5983DH"], "Invalid" : [ "12j4h", "k3j51l" ], "Predecessor" : { - "9999ZZ" : "9998", - "1000AA" : "0999" + "9999" : "9998", + "1000" : "0999", + "9999ZZ": "9999ZY", + "1000AA": "0999ZZ" }, "Successor" : { - "0999ZZ" : "1000", - "3456JT" : "3457" + "0999" : "1000", + "3456" : "3457", + "0999ZZ": "1000AA", + "3456JT": "3456JU" }, - "IsBefore" : {} + "IsBefore" : { + "1234": "1236", + "1234AA": "1234AB", + "1235": "1237AA", + "1234AA": "1236AA", + "1235ZY": "1235ZZ", + "1234ZZ": "1235" + } } } \ No newline at end of file