diff --git a/src/IbanNet/IbanValidator.cs b/src/IbanNet/IbanValidator.cs index 211c514a..76b2e207 100644 --- a/src/IbanNet/IbanValidator.cs +++ b/src/IbanNet/IbanValidator.cs @@ -58,7 +58,13 @@ public IbanValidator(Lazy> registry) /// /// Gets the supported countries. /// - public IReadOnlyDictionary SupportedCountries + // TODO: v4, change to dictionary for faster lookup. + public IEnumerable SupportedCountries => ((ICountryValidationSupport)this).SupportedCountries.Values; + + /// + /// Gets the supported countries. + /// + IReadOnlyDictionary ICountryValidationSupport.SupportedCountries { get { diff --git a/test/IbanNet.Tests/IbanValidatorTests.cs b/test/IbanNet.Tests/IbanValidatorTests.cs index 1cbebe6b..dc355871 100644 --- a/test/IbanNet.Tests/IbanValidatorTests.cs +++ b/test/IbanNet.Tests/IbanValidatorTests.cs @@ -181,10 +181,18 @@ public void When_validating_good_iban_should_validate(string countryCode, string actual.Should().BeEquivalentTo(expectedResult); } + [Test] + public void When_getting_supported_countries_should_match_default_registry() + { + _validator.SupportedCountries + .Should() + .BeEquivalentTo(new IbanRegistry()); + } + [Test] public void When_casting_readonly_countries_dictionary_should_not_be_able_to_add() { - var countries = (IDictionary)_validator.SupportedCountries; + var countries = (IDictionary)((ICountryValidationSupport)_validator).SupportedCountries; // Act Action act = () => countries.Add("key", new CountryInfo());