diff --git a/Qowaiv.sln b/Qowaiv.sln index a839d20b0..7b33610a3 100644 --- a/Qowaiv.sln +++ b/Qowaiv.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27004.2009 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29020.237 MinimumVisualStudioVersion = 15.0 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Qowaiv", "src\Qowaiv\Qowaiv.csproj", "{ACF6F726-8CBE-4F7C-89EF-9002A6441D19}" EndProject @@ -25,7 +25,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Props", "Props", "{696E5B2C props\analytics.props = props\analytics.props props\common.props = props\common.props props\test.props = props\test.props - props\version.props = props\version.props EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Qowaiv.UnitTests", "test\Qowaiv.UnitTests\Qowaiv.UnitTests.csproj", "{21E4DDC5-08FE-42EA-9B82-7C54C176161F}" @@ -40,14 +39,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Qowaiv.ComponentModel", "sr EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Qowaiv.ComponentModel.UnitTests", "test\Qowaiv.ComponentModel.UnitTests\Qowaiv.ComponentModel.UnitTests.csproj", "{8C026B5F-87B3-49F9-9D21-75774972A53A}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Qowaiv.Web", "src\Qowaiv.Web\Qowaiv.Web.csproj", "{0A58FB98-8D08-4717-8755-3E0440F92A68}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Qowaiv.Json.Newtonsoft", "src\Qowaiv.Json.Newtonsoft\Qowaiv.Json.Newtonsoft.csproj", "{BCFDC29E-57F5-4D3C-85E2-D37217EE62A6}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Qowaiv.TypeScript", "src\Qowaiv.TypeScript\Qowaiv.TypeScript.csproj", "{DC61BD14-58AF-4E3F-8CE2-ED0D09E5D116}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Qowaiv.TypeScript.UnitTests", "test\Qowaiv.TypeScript.UnitTests\Qowaiv.TypeScript.UnitTests.csproj", "{39C679AC-9B31-4A6F-8136-2B7797126B47}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Qowaiv.Json.Newtonsoft.UnitTests", "test\Qowaiv.Json.Newtonsoft.UnitTests\Qowaiv.Json.Newtonsoft.UnitTests.csproj", "{864B79CC-0B90-475D-8EDC-C69830F8D773}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Qowaiv.CodeGenerator", "tooling\Qowaiv.CodeGenerator\Qowaiv.CodeGenerator.csproj", "{E76B08DA-74EE-415C-B554-BA395499AB1A}" @@ -86,22 +79,10 @@ Global {8C026B5F-87B3-49F9-9D21-75774972A53A}.Debug|Any CPU.Build.0 = Debug|Any CPU {8C026B5F-87B3-49F9-9D21-75774972A53A}.Release|Any CPU.ActiveCfg = Release|Any CPU {8C026B5F-87B3-49F9-9D21-75774972A53A}.Release|Any CPU.Build.0 = Release|Any CPU - {0A58FB98-8D08-4717-8755-3E0440F92A68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0A58FB98-8D08-4717-8755-3E0440F92A68}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0A58FB98-8D08-4717-8755-3E0440F92A68}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0A58FB98-8D08-4717-8755-3E0440F92A68}.Release|Any CPU.Build.0 = Release|Any CPU {BCFDC29E-57F5-4D3C-85E2-D37217EE62A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BCFDC29E-57F5-4D3C-85E2-D37217EE62A6}.Debug|Any CPU.Build.0 = Debug|Any CPU {BCFDC29E-57F5-4D3C-85E2-D37217EE62A6}.Release|Any CPU.ActiveCfg = Release|Any CPU {BCFDC29E-57F5-4D3C-85E2-D37217EE62A6}.Release|Any CPU.Build.0 = Release|Any CPU - {DC61BD14-58AF-4E3F-8CE2-ED0D09E5D116}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DC61BD14-58AF-4E3F-8CE2-ED0D09E5D116}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DC61BD14-58AF-4E3F-8CE2-ED0D09E5D116}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DC61BD14-58AF-4E3F-8CE2-ED0D09E5D116}.Release|Any CPU.Build.0 = Release|Any CPU - {39C679AC-9B31-4A6F-8136-2B7797126B47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {39C679AC-9B31-4A6F-8136-2B7797126B47}.Debug|Any CPU.Build.0 = Debug|Any CPU - {39C679AC-9B31-4A6F-8136-2B7797126B47}.Release|Any CPU.ActiveCfg = Release|Any CPU - {39C679AC-9B31-4A6F-8136-2B7797126B47}.Release|Any CPU.Build.0 = Release|Any CPU {864B79CC-0B90-475D-8EDC-C69830F8D773}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {864B79CC-0B90-475D-8EDC-C69830F8D773}.Debug|Any CPU.Build.0 = Debug|Any CPU {864B79CC-0B90-475D-8EDC-C69830F8D773}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -118,9 +99,7 @@ Global {696E5B2C-1F1D-4ACD-BBD4-40594FC7BF11} = {A4C3C9FF-4EED-41FE-8849-C896429254B5} {21E4DDC5-08FE-42EA-9B82-7C54C176161F} = {40C1E942-8DB1-4E58-8FB4-71F5EDA66029} {48FB953F-7321-4D10-BED7-3A2FE3C5EF5B} = {40C1E942-8DB1-4E58-8FB4-71F5EDA66029} - {50F34D90-4AD2-4E6F-8A75-EA3656B31480} = {CCCCEB32-7082-431D-A7DC-3C6E213DA8D4} {8C026B5F-87B3-49F9-9D21-75774972A53A} = {40C1E942-8DB1-4E58-8FB4-71F5EDA66029} - {39C679AC-9B31-4A6F-8136-2B7797126B47} = {40C1E942-8DB1-4E58-8FB4-71F5EDA66029} {864B79CC-0B90-475D-8EDC-C69830F8D773} = {40C1E942-8DB1-4E58-8FB4-71F5EDA66029} {E76B08DA-74EE-415C-B554-BA395499AB1A} = {CCCCEB32-7082-431D-A7DC-3C6E213DA8D4} EndGlobalSection diff --git a/README.md b/README.md index 624a1c494..79d9b21eb 100644 --- a/README.md +++ b/README.md @@ -210,7 +210,6 @@ formatting of the object is used, where FormattingArgumentsCollection.Format() uses the default specified at the formatting collection of a type (if available). ### Threading -========= Because there are scenario's where you want to set typical values as a country or a currency for the context of the current thread (like the culture info) there is a possibility to add these to the Qowaiv.Threading.ThreadDomain. @@ -219,6 +218,12 @@ These values can be configured (in the application settings) or can be created w a creator function that can be registered. If not specified otherwise the current country will be created (if possible) based on the current culture. +## MVC ModelBinding +When using Qowaiv with MVC (not ASP.NET core) you need a specific model binder. +This binder is needed because the default model binder don't call a type +converter in case the input is string.Empty. +The example can be found [here](src/Qowaiv.Web/Mvc/typeConverterModelBinder.cs). + ## Qowaiv clock The `Clock` class is an outsider within the Qowaiv library. It is a solution for a problem that is not related to Domain-Driven Design, but to the fact that diff --git a/props/common.props b/props/common.props index ea0323456..2ad5da8a8 100644 --- a/props/common.props +++ b/props/common.props @@ -1,7 +1,6 @@ - diff --git a/props/version.props b/props/version.props deleted file mode 100644 index 8f62b0111..000000000 --- a/props/version.props +++ /dev/null @@ -1,7 +0,0 @@ - - - - 3.2.5 - - - diff --git a/src/Qowaiv.ComponentModel/DataAnnotations/DistinctValuesAttribute.cs b/src/Qowaiv.ComponentModel/DataAnnotations/DistinctValuesAttribute.cs index 303c548d0..cdee6db9c 100644 --- a/src/Qowaiv.ComponentModel/DataAnnotations/DistinctValuesAttribute.cs +++ b/src/Qowaiv.ComponentModel/DataAnnotations/DistinctValuesAttribute.cs @@ -31,7 +31,7 @@ public override bool IsValid(object value) return true; } - var collection = Guard.IsTypeOf(value, nameof(value)).Cast(); + var collection = Guard.IsInstanceOf(value, nameof(value)).Cast(); var checker = new HashSet(EqualityComparer); return collection.All(checker.Add); diff --git a/src/Qowaiv.ComponentModel/Qowaiv.ComponentModel.csproj b/src/Qowaiv.ComponentModel/Qowaiv.ComponentModel.csproj index 6ffddbdeb..0ff15d87a 100644 --- a/src/Qowaiv.ComponentModel/Qowaiv.ComponentModel.csproj +++ b/src/Qowaiv.ComponentModel/Qowaiv.ComponentModel.csproj @@ -3,25 +3,13 @@ - netstandard2.0;net45 + netstandard2.0 + true + 4.0.0 - - bin\Release\netstandard2.0\Qowaiv.ComponentModel.xml - - - bin\Debug\netstandard2.0\Qowaiv.ComponentModel.xml - - - - - - - - - - + diff --git a/src/Qowaiv.ComponentModel/Rules/Globalization/PostalCodeRule.cs b/src/Qowaiv.ComponentModel/Rules/Globalization/PostalCodeRule.cs deleted file mode 100644 index 29832b5e6..000000000 --- a/src/Qowaiv.ComponentModel/Rules/Globalization/PostalCodeRule.cs +++ /dev/null @@ -1,56 +0,0 @@ -using Qowaiv.ComponentModel.Messages; -using System.ComponentModel.DataAnnotations; -using Qowaiv.Globalization; -using System; - -namespace Qowaiv.ComponentModel.Rules.Globalization -{ - /// Rule that can validate a - /// being valid for a specific . - /// - public class PostalCodeRule : ValidationRule - { - /// Creates a new instance of a . - /// - /// The postal code to validate. - /// - /// - /// The country to validate it for. - /// - /// - /// The name of the property in the model. - /// - /// - /// The name of the property in the model. - /// - public PostalCodeRule(PostalCode postalCode, Country country, string postalCodeName, string countryName) - : base(postalCodeName, countryName) - { - PostalCode = postalCode; - Country = country; - } - - /// Gets the involved postal code. - public PostalCode PostalCode { get; } - /// Gets the involved country. - public Country Country { get; } - - /// Returns true if postal code is valid (or if the postal code or country is empty or unknown). - protected override bool IsValid(ValidationContext validationContext) - { - return PostalCode.IsEmptyOrUnknown() || Country.IsEmptyOrUnknown() || PostalCode.IsValid(Country); - } - - /// Gets the error message. - protected override Func ErrorMessageString => () => string.Format(QowaivComponentModelMessages.PostalCodeValidator_ErrorMessage, PostalCode, Country.DisplayName); - - /// Returns if the - /// is valid for a specific , otherwise false. - /// - public static ValidationResult IsValid(PostalCode postalCode, Country country, string postalCodeName, string countryName) - { - var rule = new PostalCodeRule(postalCode, country, postalCodeName, countryName); - return rule.Validate(null); - } - } -} diff --git a/src/Qowaiv.ComponentModel/Rules/IValidationRule.cs b/src/Qowaiv.ComponentModel/Rules/IValidationRule.cs deleted file mode 100644 index a3fa14e01..000000000 --- a/src/Qowaiv.ComponentModel/Rules/IValidationRule.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Qowaiv.ComponentModel.Messages; -using Qowaiv.ComponentModel.Validation; -using System.ComponentModel.DataAnnotations; - -namespace Qowaiv.ComponentModel.Rules -{ - /// The rule equivalent of the . - /// - /// Where the should apply on isolated - /// properties, an should be used to define - /// constraints that imply multiple properties. - /// - public interface IValidationRule - { - /// Validates the rule. - /// - /// The in most cases provided via the - /// . - /// - /// - /// when the rule is valid, - /// otherwise an descriptive . - /// - ValidationResult Validate(ValidationContext validationContext); - } -} diff --git a/src/Qowaiv.ComponentModel/Rules/ValidationExpression.cs b/src/Qowaiv.ComponentModel/Rules/ValidationExpression.cs deleted file mode 100644 index 92396678d..000000000 --- a/src/Qowaiv.ComponentModel/Rules/ValidationExpression.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; - -namespace Qowaiv.ComponentModel.Rules -{ - /// Represents a validation rule defined by a delegate expression. - /// - /// Used by . - /// - internal class ValidationExpression: ValidationRule - { - /// Creates a new instance of a . - public ValidationExpression(Func isValid, Func message, params string[] propertyNames): - base(propertyNames) - { - Expression = Guard.NotNull(isValid, nameof(isValid)); - ErrorMessageString = Guard.NotNull(message, nameof(message)); - } - - /// The expression to execute. - public Func Expression { get; } - - /// Gets the error message. - protected override Func ErrorMessageString { get; } - - /// Returns true if the expression did not return false. - protected override bool IsValid(ValidationContext validationContext) => Expression(validationContext) != false; - } -} diff --git a/src/Qowaiv.ComponentModel/Rules/ValidationRule.cs b/src/Qowaiv.ComponentModel/Rules/ValidationRule.cs deleted file mode 100644 index b60958cd8..000000000 --- a/src/Qowaiv.ComponentModel/Rules/ValidationRule.cs +++ /dev/null @@ -1,136 +0,0 @@ -using Qowaiv.ComponentModel.Messages; -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Globalization; -using System.Linq; -using System.Reflection; - -namespace Qowaiv.ComponentModel.Rules -{ - /// Represents a validation rule that is intended to be validated - /// during . - /// - public abstract class ValidationRule : IValidationRule - { - /// Creates a new instance of a . - /// - /// The involved properties. - /// - protected ValidationRule(params string[] propertyNames) - : this(propertyNames ?? Enumerable.Empty()) { } - - /// Creates a new instance of a . - /// - /// The involved properties. - /// - protected ValidationRule(IEnumerable propertyNames) - { - PropertyNames = (propertyNames ?? Enumerable.Empty()).ToArray(); - } - - /// Gets the involved property names. - public string[] PropertyNames { get; } - - /// Gets and set an error message to if validation fails. - public string ErrorMessage { get; set; } - - /// Gets and set the error message resource name to use in order to look up the System.ComponentModel.DataAnnotations.ValidationAttribute.ErrorMessageResourceType - /// property value if validation fails. - /// - public string ErrorMessageResourceName { get; set; } - - /// Gets or sets the resource type to use for error-message lookup if validation fails. - public Type ErrorMessageResourceType { get; set; } - - /// Gets the localized validation error message. - protected virtual Func ErrorMessageString => GetResourceErrorMessage() ?? (() => ErrorMessage); - - /// Gets the message based on the resource. - /// - /// This is more or less one-to-on copied from . - /// - protected Func GetResourceErrorMessage() - { - if (ErrorMessageResourceType == null || string.IsNullOrEmpty(ErrorMessageResourceName)) - { - return null; - } - var property = ErrorMessageResourceType.GetProperty(ErrorMessageResourceName, BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic); - if (property != null) - { - var propertyGetter = property.GetGetMethod(true /*nonPublic*/); - // We only support internal and public properties - if (propertyGetter == null || (!propertyGetter.IsAssembly && !propertyGetter.IsPublic)) - { - // Set the property to null so the exception is thrown as if the property wasn't found - property = null; - } - if (property != null) - { - if (property.PropertyType != typeof(string)) - { - throw new InvalidOperationException( - string.Format( - CultureInfo.CurrentCulture, - QowaivComponentModelMessages.ValidationRule_ResourcePropertyNotStringType, - ErrorMessageResourceType.FullName, - property.Name)); - } - return () => (string)property.GetValue(null, null); - } - } - throw new InvalidOperationException( - string.Format( - CultureInfo.CurrentCulture, - QowaivComponentModelMessages.ValidationRule_ResourceTypeDoesNotHaveProperty, - ErrorMessageResourceType.FullName, - ErrorMessageResourceName)); - } - - /// - /// - /// - /// - /// - public virtual ValidationResult Validate(ValidationContext validationContext) - { - if (IsValid(validationContext)) - { - return ValidationMessage.None; - } - return ValidationMessage.Error(string.Format(CultureInfo.CurrentCulture, ErrorMessageString(), PropertyNames), PropertyNames); - } - - /// Determines whether the specified value of the object is valid. - /// - /// - /// - /// true if the specified value is valid, otherwise false. - /// - protected abstract bool IsValid(ValidationContext validationContext); - - /// Creates an based on the expression. - /// - /// The isValid expression. - /// - /// - /// The message to show when the rule is not valid. - /// - /// - /// The involved property names. - /// - /// - /// If the bool? has no value, the rule is assumed not to be invalid. - /// This helps in scenario's like these: - /// - /// ValidationRule.For((context) => context.GetService<SomeService>()?.IsValid(), "Error"); - /// - /// If The service could not be resolved, the rule will be ignored. - /// - public static IValidationRule For(Func isValid, Func message, params string[] propertyNames) - { - return new ValidationExpression(isValid, message, propertyNames); - } - } -} diff --git a/src/Qowaiv.ComponentModel/Rules/ValidationRules.cs b/src/Qowaiv.ComponentModel/Rules/ValidationRules.cs deleted file mode 100644 index 55319822d..000000000 --- a/src/Qowaiv.ComponentModel/Rules/ValidationRules.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Qowaiv.ComponentModel.Messages; -using Qowaiv.ComponentModel.Validation; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; - -namespace Qowaiv.ComponentModel.Rules -{ - /// Represents a of s. - public class ValidationRules : List - { - /// Creates a new instance of . - public ValidationRules(IEnumerable rules) : base(rules) { } - - /// Validates all s. - /// - /// The in most cases provided via the - /// . - /// - /// - /// All that are not equal to . - /// - public IEnumerable Validate(ValidationContext validationContext) => this.Select(rule => rule.Validate(validationContext)).GetWithSeverity(); - - /// Validates the specified s. - /// - /// The in most cases provided via the - /// . - /// - /// - /// The s to validate. - /// - /// - /// All that are not equal to . - /// - public static IEnumerable Validate(ValidationContext validationContext, params IValidationRule[] rules) - { - var collection = new ValidationRules(rules); - return collection.Validate(validationContext); - } - } -} diff --git a/src/Qowaiv.Data.SqlClient/Qowaiv.Data.SqlClient.csproj b/src/Qowaiv.Data.SqlClient/Qowaiv.Data.SqlClient.csproj index 58a412234..7a1a77180 100644 --- a/src/Qowaiv.Data.SqlClient/Qowaiv.Data.SqlClient.csproj +++ b/src/Qowaiv.Data.SqlClient/Qowaiv.Data.SqlClient.csproj @@ -1,24 +1,15 @@ - + - net45;netstandard2.0 + netstandard2.0 + true + 4.0.0 - - bin\Release\netstandard2.0\Qowaiv.Data.SqlClient.xml - - - bin\Debug\netstandard2.0\Qowaiv.Data.SqlClient.xml - - - - - - - - + + diff --git a/src/Qowaiv.Json.Newtonsoft/Qowaiv.Json.Newtonsoft.csproj b/src/Qowaiv.Json.Newtonsoft/Qowaiv.Json.Newtonsoft.csproj index 1985840d0..0e9cf4119 100644 --- a/src/Qowaiv.Json.Newtonsoft/Qowaiv.Json.Newtonsoft.csproj +++ b/src/Qowaiv.Json.Newtonsoft/Qowaiv.Json.Newtonsoft.csproj @@ -1,25 +1,18 @@ - + - net45;netstandard2.0 + netstandard2.0 + true - - bin\Release\netstandard2.0\Qowaiv.Json.NewtonSoft.xml - - - bin\Debug\netstandard2.0\Qowaiv.Json.NewtonSoft.xml - - - - + diff --git a/src/Qowaiv.Json.Newtonsoft/QowaivJsonConverter.cs b/src/Qowaiv.Json.Newtonsoft/QowaivJsonConverter.cs index 6fc7da1c0..95a3f191a 100644 --- a/src/Qowaiv.Json.Newtonsoft/QowaivJsonConverter.cs +++ b/src/Qowaiv.Json.Newtonsoft/QowaivJsonConverter.cs @@ -56,8 +56,8 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist Guard.NotNull(reader, nameof(reader)); Guard.NotNull(objectType, "objectType"); - var isNullable = objectType.IsGenericType; - var result = (IJsonSerializable)Activator.CreateInstance(isNullable ? objectType.GetGenericArguments()[0] : objectType); + var type = QowaivType.GetNotNullableType(objectType); + var result = (IJsonSerializable)Activator.CreateInstance(type); try { @@ -65,7 +65,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist { // Empty value for null-ables. case JsonToken.Null: - if (isNullable) { return null; } + if (type != objectType) { return null; } result.FromJson(); break; @@ -119,7 +119,7 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s writer.WriteNull(); } - var json = Guard.IsTypeOf(value, nameof(value)); + var json = Guard.IsInstanceOf(value, nameof(value)); var jsonValue = json.ToJson(); diff --git a/src/Qowaiv.Web/InternetMediaTypeExtensions.net45.cs b/src/Qowaiv.Web/InternetMediaTypeExtensions.net45.cs deleted file mode 100644 index 5fc317805..000000000 --- a/src/Qowaiv.Web/InternetMediaTypeExtensions.net45.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System.Diagnostics.CodeAnalysis; -using System.Web; - -namespace Qowaiv.Web -{ - /// Extensions that result in retrieving a . - public static class InternetMediaTypeExtensions - { - /// Gets the content type. - [ExcludeFromCodeCoverage] - public static InternetMediaType GetContentType(this HttpRequest request) - { - Guard.NotNull(request, nameof(request)); - return new HttpRequestWrapper(request).GetContentType(); - } - /// Sets the content type. - [ExcludeFromCodeCoverage] - public static void SetContentType(this HttpRequest request, InternetMediaType mediaType) - { - Guard.NotNull(request, nameof(request)); - new HttpRequestWrapper(request).SetContentType(mediaType); - } - - /// Gets the content type. - [ExcludeFromCodeCoverage] - public static InternetMediaType GetContentType(this HttpResponse response) - { - Guard.NotNull(response, nameof(response)); - return new HttpResponseWrapper(response).GetContentType(); - } - /// Sets the content type. - [ExcludeFromCodeCoverage] - public static void SetContentType(this HttpResponse response, InternetMediaType mediaType) - { - Guard.NotNull(response, nameof(response)); - new HttpResponseWrapper(response).SetContentType(mediaType); - } - - /// Gets the content type. - public static InternetMediaType GetContentType(this HttpRequestBase request) - { - Guard.NotNull(request, nameof(request)); - return InternetMediaType.Parse(request.ContentType); - } - /// Sets the content type. - public static void SetContentType(this HttpRequestBase request, InternetMediaType mediaType) - { - Guard.NotNull(request, nameof(request)); - request.ContentType = mediaType.ToString(); - } - - /// Gets the content type. - public static InternetMediaType GetContentType(this HttpResponseBase response) - { - Guard.NotNull(response, nameof(response)); - return InternetMediaType.Parse(response.ContentType); - } - /// Sets the content type. - public static void SetContentType(this HttpResponseBase response, InternetMediaType mediaType) - { - Guard.NotNull(response, nameof(response)); - response.ContentType = mediaType.ToString(); - } - } -} diff --git a/src/Qowaiv.Web/Mvc/TypeConverterModelBinder.net45.cs b/src/Qowaiv.Web/Mvc/TypeConverterModelBinder.cs similarity index 78% rename from src/Qowaiv.Web/Mvc/TypeConverterModelBinder.net45.cs rename to src/Qowaiv.Web/Mvc/TypeConverterModelBinder.cs index 395b8859a..19879b1ea 100644 --- a/src/Qowaiv.Web/Mvc/TypeConverterModelBinder.net45.cs +++ b/src/Qowaiv.Web/Mvc/TypeConverterModelBinder.cs @@ -1,12 +1,11 @@ -using System; +using Qowaiv.Reflection; +using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.ComponentModel; -using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Reflection; using System.Web.Mvc; -using Qowaiv.Reflection; namespace Qowaiv.Web.Mvc { @@ -29,12 +28,10 @@ public class TypeConverterModelBinder : DefaultModelBinder /// /// Add all types of Qowaiv that are supported by the model binder. /// - [SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline", - Justification = "To complex for straight forward assignment.")] static TypeConverterModelBinder() { - var qowaivAssembly = typeof(Qowaiv.SingleValueObjectAttribute).Assembly; - var qowaivWebAssembly = typeof(Qowaiv.Web.InternetMediaType).Assembly; + var qowaivAssembly = typeof(SingleValueObjectAttribute).Assembly; + var qowaivWebAssembly = typeof(InternetMediaType).Assembly; // Add types. AddAssembly(qowaivAssembly); @@ -47,7 +44,7 @@ static TypeConverterModelBinder() /// public static void AddAssembly(Assembly assembly) { - Guard.NotNull(assembly, "assembly"); + Guard.NotNull(assembly, nameof(assembly)); var tps = assembly.GetTypes() .Where(tp => QowaivType.IsSingleValueObject(tp)) .ToArray(); @@ -63,7 +60,7 @@ public static void AddAssembly(Assembly assembly) /// public static void AddTypes(params Type[] tps) { - Guard.NotNull(tps, "tps"); + Guard.NotNull(tps, nameof(tps)); foreach (var tp in tps) { AddType(tp); @@ -97,14 +94,10 @@ public static void AddType(Type tp) /// /// Type to remove. /// - public static void RemoveType(Type tp) - { - TypeConverter converter; - TypeConverters.TryRemove(tp, out converter); - } + public static void RemoveType(Type tp) => TypeConverters.TryRemove(tp, out _); /// Gets the types that where added to the model binder. - public static IEnumerable Types { get { return TypeConverters.Keys; } } + public static IEnumerable Types => TypeConverters.Keys; /// Registers the model binder to the specified model binder dictionary. /// The model binder dictionary to add to. @@ -120,16 +113,15 @@ public static void RemoveType(Type tp) /// public static void RegisterForAll(ModelBinderDictionary binders) { - Guard.NotNull(binders, "binders"); + Guard.NotNull(binders, nameof(binders)); foreach (var tp in TypeConverters.Keys) { - binders.Add(tp, TypeConverterModelBinder.Instance); + binders.Add(tp, Instance); } } /// The singleton instance of the model binder. - public static TypeConverterModelBinder Instance { get { return s_Instance; } } - private static TypeConverterModelBinder s_Instance = new TypeConverterModelBinder(); + public static TypeConverterModelBinder Instance { get; } = new TypeConverterModelBinder(); /// Constructor. /// @@ -141,22 +133,19 @@ public static void RegisterForAll(ModelBinderDictionary binders) /// Controller context. /// The binding context. /// The bound model. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", - Justification = "All exceptions are caught and added as errors to the model state.")] public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { - Guard.NotNull(bindingContext, "bindingContext"); + Guard.NotNull(bindingContext, nameof(bindingContext)); // Get the value result. var valueResult = bindingContext.ValueProvider.GetValue(bindingContext.ModelName); - if (valueResult == null) { return null; } + if (valueResult is null) { return null; } - string value = null; - var valueAsArray = valueResult.RawValue as Array; - if (valueAsArray != null && valueAsArray.Length > 0) + string value; + if (valueResult.RawValue is Array array && array.Length > 0) { // provided value is an array; take first element (if available) - value = valueAsArray.GetValue(0) as string; + value = array.GetValue(0) as string; } else { diff --git a/src/Qowaiv.Web/Qowaiv.Web.csproj b/src/Qowaiv.Web/Qowaiv.Web.csproj deleted file mode 100644 index a4a17dc81..000000000 --- a/src/Qowaiv.Web/Qowaiv.Web.csproj +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - net45;netstandard2.0 - - - - bin\Release\net45\Qowaiv.Data.SqlClient.xml - - - bin\Debug\net45\Qowaiv.Data.SqlClient.xml - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Qowaiv.Web/QowaivWebMessages.Designer.cs b/src/Qowaiv.Web/QowaivWebMessages.Designer.cs deleted file mode 100644 index e1fad5803..000000000 --- a/src/Qowaiv.Web/QowaivWebMessages.Designer.cs +++ /dev/null @@ -1,72 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.18444 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Qowaiv.Web { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - public class QowaivWebMessages { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal QowaivWebMessages() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Qowaiv.Web.QowaivWebMessages", typeof(QowaivWebMessages).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to Not a valid internet media type. - /// - public static string FormatExceptionInternetMediaType { - get { - return ResourceManager.GetString("FormatExceptionInternetMediaType", resourceCulture); - } - } - } -} diff --git a/src/Qowaiv.Web/QowaivWebMessages.nl.resx b/src/Qowaiv.Web/QowaivWebMessages.nl.resx deleted file mode 100644 index 818365ac9..000000000 --- a/src/Qowaiv.Web/QowaivWebMessages.nl.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Geen geldig internet media type - - \ No newline at end of file diff --git a/src/Qowaiv.Web/QowaivWebMessages.resx b/src/Qowaiv.Web/QowaivWebMessages.resx deleted file mode 100644 index 5a9cee380..000000000 --- a/src/Qowaiv.Web/QowaivWebMessages.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Not a valid internet media type - - \ No newline at end of file diff --git a/src/Qowaiv.Web/Conversion/InternetMediaTypeTypeConverter.cs b/src/Qowaiv/Conversion/Web/InternetMediaTypeTypeConverter.cs similarity index 85% rename from src/Qowaiv.Web/Conversion/InternetMediaTypeTypeConverter.cs rename to src/Qowaiv/Conversion/Web/InternetMediaTypeTypeConverter.cs index 24cb497c4..f8691364a 100644 --- a/src/Qowaiv.Web/Conversion/InternetMediaTypeTypeConverter.cs +++ b/src/Qowaiv/Conversion/Web/InternetMediaTypeTypeConverter.cs @@ -1,7 +1,7 @@ -using Qowaiv.Conversion; +using Qowaiv.Web; using System.Globalization; -namespace Qowaiv.Web.Conversion +namespace Qowaiv.Conversion.Web { /// Provides a conversion for an Internet media type. public class InternetMediaTypeTypeConverter : SvoTypeConverter diff --git a/src/Qowaiv/EmailAddress.cs b/src/Qowaiv/EmailAddress.cs index f911afc14..640f40847 100644 --- a/src/Qowaiv/EmailAddress.cs +++ b/src/Qowaiv/EmailAddress.cs @@ -84,7 +84,7 @@ public struct EmailAddress : ISerializable, IXmlSerializable, IJsonSerializable, #region Methods /// Returns true if the email address is empty, otherwise false. - public bool IsEmpty() => m_Value == default(string); + public bool IsEmpty() => m_Value == default; /// Returns true if the email address is unknown, otherwise false. public bool IsUnknown() => m_Value == Unknown.m_Value; @@ -151,7 +151,7 @@ void IXmlSerializable.WriteXml(XmlWriter writer) /// Generates an email address from a JSON null object representation. void IJsonSerializable.FromJson() { - m_Value = default(string); + m_Value = default; } /// Generates an email address from a JSON string representation. @@ -184,7 +184,7 @@ void IJsonSerializable.FromJson(string jsonString) /// Converts an email address into its JSON object representation. object IJsonSerializable.ToJson() { - return m_Value == default(string) ? null : ToString(CultureInfo.InvariantCulture); + return m_Value == default ? null : ToString(CultureInfo.InvariantCulture); } #endregion diff --git a/src/Qowaiv/Financial/BankIdentifierCode.cs b/src/Qowaiv/Financial/BankIdentifierCode.cs index 8f3361db0..7ad7b951f 100644 --- a/src/Qowaiv/Financial/BankIdentifierCode.cs +++ b/src/Qowaiv/Financial/BankIdentifierCode.cs @@ -97,7 +97,7 @@ public Country Country #region Methods /// Returns true if the BIC is empty, otherwise false. - public bool IsEmpty() => m_Value == default(string); + public bool IsEmpty() => m_Value == default; /// Returns true if the BIC is unknown, otherwise false. public bool IsUnknown() => m_Value == Unknown.m_Value; @@ -162,7 +162,7 @@ void IXmlSerializable.WriteXml(XmlWriter writer) #region (JSON) (De)serialization /// Generates a BIC from a JSON null object representation. - void IJsonSerializable.FromJson() => m_Value = default(string); + void IJsonSerializable.FromJson() => m_Value = default; /// Generates a BIC from a JSON string representation. @@ -195,7 +195,7 @@ void IJsonSerializable.FromJson(string jsonString) /// Converts a BIC into its JSON object representation. object IJsonSerializable.ToJson() { - return m_Value == default(string) ? null : ToString(CultureInfo.InvariantCulture); + return m_Value == default ? null : ToString(CultureInfo.InvariantCulture); } #endregion diff --git a/src/Qowaiv/Financial/Currency.cs b/src/Qowaiv/Financial/Currency.cs index a4f722c2b..81e489cca 100644 --- a/src/Qowaiv/Financial/Currency.cs +++ b/src/Qowaiv/Financial/Currency.cs @@ -75,16 +75,16 @@ public partial struct Currency : ISerializable, IXmlSerializable, IJsonSerializa public string IsoCode => GetResourceString("ISO", CultureInfo.InvariantCulture); ///Gets the numeric code defined in ISO 4217 for the currency. - public int IsoNumericCode => m_Value == default(string) ? 0 : XmlConvert.ToInt32(GetResourceString("Num", CultureInfo.InvariantCulture)); + public int IsoNumericCode => m_Value == default ? 0 : XmlConvert.ToInt32(GetResourceString("Num", CultureInfo.InvariantCulture)); ///Gets the symbol for a currency. - public string Symbol => m_Value == default(string) ? "" : GetResourceString("Symbol", CultureInfo.InvariantCulture); + public string Symbol => m_Value == default ? "" : GetResourceString("Symbol", CultureInfo.InvariantCulture); ///Gets the number of after the decimal separator. - public int Digits => m_Value == default(string) ? 0 : XmlConvert.ToInt32(GetResourceString("Digits", CultureInfo.InvariantCulture)); + public int Digits => m_Value == default ? 0 : XmlConvert.ToInt32(GetResourceString("Digits", CultureInfo.InvariantCulture)); /// Gets the start date from witch the currency exists. - public Date StartDate => m_Value == default(string) ? Date.MinValue : (Date)XmlConvert.ToDateTime(GetResourceString("StartDate", CultureInfo.InvariantCulture), "yyyy-MM-dd"); + public Date StartDate => m_Value == default ? Date.MinValue : (Date)XmlConvert.ToDateTime(GetResourceString("StartDate", CultureInfo.InvariantCulture), "yyyy-MM-dd"); /// If the currency does not exist anymore, the end date is given, otherwise null. public Date? EndDate @@ -101,7 +101,7 @@ public partial struct Currency : ISerializable, IXmlSerializable, IJsonSerializa #region Methods /// Returns true if the currency is empty, otherwise false. - public bool IsEmpty() => m_Value == default(string); + public bool IsEmpty() => m_Value == default; /// Returns true if the currency is unknown, otherwise false. public bool IsUnknown() => m_Value == Unknown.m_Value; @@ -193,7 +193,7 @@ void IXmlSerializable.WriteXml(XmlWriter writer) #region (JSON) (De)serialization /// Generates a currency from a JSON null object representation. - void IJsonSerializable.FromJson() => m_Value = default(string); + void IJsonSerializable.FromJson() => m_Value = default; /// Generates a currency from a JSON string representation. @@ -229,7 +229,7 @@ void IJsonSerializable.FromJson(Int64 jsonInteger) /// Converts a currency into its JSON object representation. object IJsonSerializable.ToJson() { - return m_Value == default(string) ? null : ToString(CultureInfo.InvariantCulture); + return m_Value == default ? null : ToString(CultureInfo.InvariantCulture); } #endregion @@ -676,7 +676,7 @@ internal string GetResourceString(string postfix, IFormatProvider formatProvider /// internal string GetResourceString(string postfix, CultureInfo culture) { - if (m_Value == default(string)) { return string.Empty; } + if (m_Value == default) { return string.Empty; } return ResourceManager.GetString(m_Value + '_' + postfix, culture ?? CultureInfo.CurrentCulture) ?? string.Empty; } diff --git a/src/Qowaiv/Financial/InternationalBankAccountNumber.cs b/src/Qowaiv/Financial/InternationalBankAccountNumber.cs index 0b61c4b35..9925f7b20 100644 --- a/src/Qowaiv/Financial/InternationalBankAccountNumber.cs +++ b/src/Qowaiv/Financial/InternationalBankAccountNumber.cs @@ -64,7 +64,7 @@ public Country Country { get { - if (m_Value == default(string)) + if (m_Value == default) { return Country.Empty; } @@ -81,7 +81,7 @@ public Country Country #region Methods /// Returns true if the IBAN is empty, otherwise false. - public bool IsEmpty() => m_Value == default(string); + public bool IsEmpty() => m_Value == default; /// Returns true if the Gender is unknown, otherwise false. public bool IsUnknown() => m_Value == Unknown.m_Value; @@ -146,7 +146,7 @@ void IXmlSerializable.WriteXml(XmlWriter writer) #region (JSON) (De)serialization /// Generates an IBAN from a JSON null object representation. - void IJsonSerializable.FromJson() => m_Value = default(string); + void IJsonSerializable.FromJson() => m_Value = default; /// Generates an IBAN from a JSON string representation. /// @@ -178,7 +178,7 @@ void IJsonSerializable.FromJson(string jsonString) /// Converts an IBAN into its JSON object representation. object IJsonSerializable.ToJson() { - return m_Value == default(string) ? null : ToUnformattedString(); + return m_Value == default ? null : ToUnformattedString(); } #endregion @@ -191,7 +191,7 @@ private string DebuggerDisplay { get { - if (m_Value == default(string)) + if (m_Value == default) { return "IBAN: (empty)"; } @@ -206,7 +206,7 @@ private string DebuggerDisplay /// Formats the IBAN without spaces. private string ToUnformattedString() { - if (m_Value == default(string)) + if (m_Value == default) { return string.Empty; } @@ -225,7 +225,7 @@ private string ToUnformattedString() /// Formats the IBAN with spaces. private string ToFormattedString() { - if (m_Value == default(string)) + if (m_Value == default) { return string.Empty; } diff --git a/src/Qowaiv/Formatting/FormattingArguments.cs b/src/Qowaiv/Formatting/FormattingArguments.cs index 55ac389ff..6198a6475 100644 --- a/src/Qowaiv/Formatting/FormattingArguments.cs +++ b/src/Qowaiv/Formatting/FormattingArguments.cs @@ -12,7 +12,7 @@ namespace Qowaiv.Formatting public struct FormattingArguments : ISerializable { /// Represents empty/not set formatting arguments. - public static readonly FormattingArguments None = new FormattingArguments(default(string), null); + public static readonly FormattingArguments None = new FormattingArguments(default, null); /// Initializes a new instance of new formatting arguments. /// diff --git a/src/Qowaiv/Gender.cs b/src/Qowaiv/Gender.cs index 286a0b5fe..09dc40018 100644 --- a/src/Qowaiv/Gender.cs +++ b/src/Qowaiv/Gender.cs @@ -90,7 +90,7 @@ public struct Gender : ISerializable, IXmlSerializable, IJsonSerializable, IForm #region Methods /// Returns true if the Gender is empty, otherwise false. - public bool IsEmpty() => m_Value == default(byte); + public bool IsEmpty() => m_Value == default; /// Returns true if the Gender is unknown, otherwise false. public bool IsUnknown() => m_Value == Unknown.m_Value; @@ -173,7 +173,7 @@ void IXmlSerializable.WriteXml(XmlWriter writer) /// Generates a Gender from a JSON null object representation. void IJsonSerializable.FromJson() { - m_Value = default(byte); + m_Value = default; } /// Generates a Gender from a JSON string representation. @@ -222,7 +222,7 @@ private string DebuggerDisplay { get { - if (m_Value == default(byte)) { return "Gender: (empty)"; } + if (m_Value == default) { return "Gender: (empty)"; } return "Gender: " + GetDisplayName(CultureInfo.InvariantCulture); } } diff --git a/src/Qowaiv/Globalization/Country.cs b/src/Qowaiv/Globalization/Country.cs index 7cf5228d1..a50680612 100644 --- a/src/Qowaiv/Globalization/Country.cs +++ b/src/Qowaiv/Globalization/Country.cs @@ -83,7 +83,7 @@ public partial struct Country : ISerializable, IXmlSerializable, IJsonSerializab /// /// The numeric code defined in ISO 3166-1 for the country/region. /// - public int IsoNumericCode { get { return m_Value == default(string) ? 0 : XmlConvert.ToInt32(GetResourceString("ISO", CultureInfo.InvariantCulture)); } } + public int IsoNumericCode { get { return m_Value == default ? 0 : XmlConvert.ToInt32(GetResourceString("ISO", CultureInfo.InvariantCulture)); } } /// Gets the country calling code as defined by ITU-T. /// @@ -95,7 +95,7 @@ public partial struct Country : ISerializable, IXmlSerializable, IJsonSerializab public bool RegionInfoExists { get { return !string.IsNullOrEmpty(GetResourceString("RegionInfoExists", CultureInfo.InvariantCulture)); } } /// Gets the start date from witch the country exists. - public Date StartDate { get { return m_Value == default(string) ? Date.MinValue : (Date)XmlConvert.ToDateTime(GetResourceString("StartDate", CultureInfo.InvariantCulture), "yyyy-MM-dd"); } } + public Date StartDate { get { return m_Value == default ? Date.MinValue : (Date)XmlConvert.ToDateTime(GetResourceString("StartDate", CultureInfo.InvariantCulture), "yyyy-MM-dd"); } } /// If the country does not exist anymore, the end date is given, otherwise null. public Date? EndDate @@ -112,7 +112,7 @@ public partial struct Country : ISerializable, IXmlSerializable, IJsonSerializab #region Methods /// Returns true if the Country is empty, otherwise false. - public bool IsEmpty() => m_Value == default(string); + public bool IsEmpty() => m_Value == default; /// Returns true if the Country is unknown, otherwise false. public bool IsUnknown() => m_Value == Unknown.m_Value; @@ -223,7 +223,7 @@ void IXmlSerializable.WriteXml(XmlWriter writer) #region (JSON) (De)serialization /// Generates a Country from a JSON null object representation. - void IJsonSerializable.FromJson() => m_Value = default(string); + void IJsonSerializable.FromJson() => m_Value = default; /// Generates a Country from a JSON string representation. /// @@ -268,7 +268,7 @@ private string DebuggerDisplay { get { - if (m_Value == default(string)) + if (m_Value == default) { return "Country: (empty)"; } @@ -575,7 +575,7 @@ public static bool TryParse(string s, IFormatProvider formatProvider, out Countr /// public static Country Create(RegionInfo region) { - if (region == null) { return default(Country); } + if (region == null) { return default; } // In .NET, Serbia and Montenegro (CS) is still active. if (region.TwoLetterISORegionName == "CS") { return CSXX; } @@ -594,7 +594,7 @@ public static Country Create(CultureInfo culture) { if (culture == null || culture == CultureInfo.InvariantCulture || culture.IsNeutralCulture) { - return default(Country); + return default; } var name = culture.Name.Substring(culture.Name.IndexOf('-') + 1); @@ -700,7 +700,7 @@ internal string GetResourceString(string postfix, IFormatProvider formatProvider /// internal string GetResourceString(string postfix, CultureInfo culture) { - if (m_Value == default(string)) { return string.Empty; } + if (m_Value == default) { return string.Empty; } return ResourceManager.GetString(m_Value + '_' + postfix, culture ?? CultureInfo.CurrentCulture) ?? string.Empty; } diff --git a/src/Qowaiv/IO/StreamSize.cs b/src/Qowaiv/IO/StreamSize.cs index f0e81d161..c18011641 100644 --- a/src/Qowaiv/IO/StreamSize.cs +++ b/src/Qowaiv/IO/StreamSize.cs @@ -411,7 +411,7 @@ void IXmlSerializable.WriteXml(XmlWriter writer) /// Generates a stream size from a JSON null object representation. void IJsonSerializable.FromJson() { - m_Value = default(long); + m_Value = default; } /// Generates a stream size from a JSON string representation. diff --git a/src/Qowaiv/Month.cs b/src/Qowaiv/Month.cs index 94dccebf8..bed4696cd 100644 --- a/src/Qowaiv/Month.cs +++ b/src/Qowaiv/Month.cs @@ -99,7 +99,7 @@ public struct Month : ISerializable, IXmlSerializable, IJsonSerializable, IForma #region Methods /// Returns true if the month is empty, otherwise false. - public bool IsEmpty() => m_Value == default(byte); + public bool IsEmpty() => m_Value == default; /// Returns true if the month is unknown, otherwise false. public bool IsUnknown() => m_Value == Unknown.m_Value; @@ -195,7 +195,7 @@ void IXmlSerializable.WriteXml(XmlWriter writer) #region (JSON) (De)serialization /// Generates a month from a JSON null object representation. - void IJsonSerializable.FromJson() => m_Value = default(Byte); + void IJsonSerializable.FromJson() => m_Value = default; /// Generates a month from a JSON string representation. /// @@ -224,7 +224,7 @@ void IXmlSerializable.WriteXml(XmlWriter writer) /// Converts a month into its JSON object representation. object IJsonSerializable.ToJson() { - return (m_Value == default(byte)) ? null : ToString(CultureInfo.InvariantCulture); + return (m_Value == default) ? null : ToString(CultureInfo.InvariantCulture); } #endregion diff --git a/src/Qowaiv/PostalCode.cs b/src/Qowaiv/PostalCode.cs index 195575c3f..32d5216d1 100644 --- a/src/Qowaiv/PostalCode.cs +++ b/src/Qowaiv/PostalCode.cs @@ -53,7 +53,7 @@ public struct PostalCode : ISerializable, IXmlSerializable, IJsonSerializable, I #region Methods /// Returns true if the postal code is empty, otherwise false. - public bool IsEmpty() => m_Value == default(string); + public bool IsEmpty() => m_Value == default; /// Returns true if the postal code is unknown, otherwise false. public bool IsUnknown() { return m_Value == PostalCode.Unknown.m_Value; } @@ -139,7 +139,7 @@ void IXmlSerializable.WriteXml(XmlWriter writer) /// Generates a postal code from a JSON null object representation. void IJsonSerializable.FromJson() { - m_Value = default(string); + m_Value = default; } /// Generates a postal code from a JSON string representation. diff --git a/src/Qowaiv/Qowaiv.csproj b/src/Qowaiv/Qowaiv.csproj index 3f49b4b9f..4ce80e648 100644 --- a/src/Qowaiv/Qowaiv.csproj +++ b/src/Qowaiv/Qowaiv.csproj @@ -3,18 +3,11 @@ - net45;netstandard2.0 + netstandard2.0 true + 4.0.0 - - - - - - - - diff --git a/src/Qowaiv/QowaivMessages.Designer.cs b/src/Qowaiv/QowaivMessages.Designer.cs index 5a9d6a460..dc9da4881 100644 --- a/src/Qowaiv/QowaivMessages.Designer.cs +++ b/src/Qowaiv/QowaivMessages.Designer.cs @@ -240,6 +240,15 @@ public class QowaivMessages { } } + /// + /// Looks up a localized string similar to Not a valid internet media type. + /// + public static string FormatExceptionInternetMediaType { + get { + return ResourceManager.GetString("FormatExceptionInternetMediaType", resourceCulture); + } + } + /// /// Looks up a localized string similar to Not valid date. /// diff --git a/src/Qowaiv/QowaivMessages.nl.resx b/src/Qowaiv/QowaivMessages.nl.resx index 5c56a4e43..c722e9dce 100644 --- a/src/Qowaiv/QowaivMessages.nl.resx +++ b/src/Qowaiv/QowaivMessages.nl.resx @@ -186,4 +186,7 @@ geen geldige ja/nee waarde + + Geen geldig internet media type + \ No newline at end of file diff --git a/src/Qowaiv/QowaivMessages.resx b/src/Qowaiv/QowaivMessages.resx index 7bda5fb85..5588a54e1 100644 --- a/src/Qowaiv/QowaivMessages.resx +++ b/src/Qowaiv/QowaivMessages.resx @@ -1,6 +1,65 @@  - + + @@ -184,4 +243,7 @@ Not a valid yes-no value - + + Not a valid internet media type + + \ No newline at end of file diff --git a/src/Qowaiv/Statistics/Elo.cs b/src/Qowaiv/Statistics/Elo.cs index a1a004d1a..2398cdeca 100644 --- a/src/Qowaiv/Statistics/Elo.cs +++ b/src/Qowaiv/Statistics/Elo.cs @@ -33,7 +33,7 @@ namespace Qowaiv.Statistics public struct Elo : ISerializable, IXmlSerializable, IJsonSerializable, IFormattable, IEquatable, IComparable, IComparable { /// Represents the zero value of an Elo. - public static readonly Elo Zero = new Elo { m_Value = default(Double) }; + public static readonly Elo Zero = new Elo { m_Value = default }; /// Represents the minimum value of an Elo. public static readonly Elo MinValue = new Elo { m_Value = Double.MinValue }; diff --git a/src/Qowaiv/Threading/ThreadDomain.cs b/src/Qowaiv/Threading/ThreadDomain.cs index 60b3c1604..6b31261b6 100644 --- a/src/Qowaiv/Threading/ThreadDomain.cs +++ b/src/Qowaiv/Threading/ThreadDomain.cs @@ -4,8 +4,6 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.ComponentModel; -using System.Configuration; -using System.Diagnostics.CodeAnalysis; using System.Threading; namespace Qowaiv.Threading @@ -16,8 +14,6 @@ namespace Qowaiv.Threading public class ThreadDomain { /// Initializes creators. - [SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline", - Justification = "To complex for straight forward assignment.")] static ThreadDomain() { Register(typeof(Country), (Thread) => Country.Create(Thread.CurrentCulture)); @@ -70,7 +66,7 @@ public static void Register(Type type, Func creator) Creators.TryAdd(type, creator); } - private static ConcurrentDictionary> Creators = new ConcurrentDictionary>(); + private static readonly ConcurrentDictionary> Creators = new ConcurrentDictionary>(); /// Constructor. /// @@ -78,7 +74,7 @@ public static void Register(Type type, Func creator) /// protected ThreadDomain() { - this.Values = new Dictionary(); + Values = new Dictionary(); } /// The underlying dictionary. @@ -99,22 +95,13 @@ public T Get() if (!Values.TryGetValue(type, out object value)) { - var str = ConfigurationManager.AppSettings[type.FullName]; - if (str != null) + if (Creators.TryGetValue(type, out Func func)) { - var converter = TypeDescriptor.GetConverter(type); - value = converter.ConvertFromString(str); + value = func.Invoke(Thread.CurrentThread); } else { - if (Creators.TryGetValue(type, out Func func)) - { - value = func.Invoke(Thread.CurrentThread); - } - else - { - value = default(T); - } + value = default(T); } } return (T)value; @@ -134,7 +121,7 @@ public T Get() public void Set(T value) { var type = Guard(typeof(T), Values.ContainsKey(typeof(T))); - this.Values[type] = value; + Values[type] = value; } /// Removes the value from the thread domain. @@ -148,7 +135,7 @@ public void Remove(Type type) } /// Clears all values from the thread domain. - public void Clear() { this.Values.Clear(); } + public void Clear() => Values.Clear(); /// Guards the type. /// diff --git a/src/Qowaiv/Threading/ThreadExtensions.cs b/src/Qowaiv/Threading/ThreadExtensions.cs index b3f28cdd1..edb574556 100644 --- a/src/Qowaiv/Threading/ThreadExtensions.cs +++ b/src/Qowaiv/Threading/ThreadExtensions.cs @@ -1,5 +1,7 @@ -using System; -using System.Diagnostics.CodeAnalysis; +#pragma warning disable IDE0060 // Remove unused parameter +// ThreadDomain works per thread, and with this extension method, the behavior is virtually extended to System.Threading.Thread. + +using System; using System.Threading; namespace Qowaiv.Threading @@ -8,27 +10,12 @@ namespace Qowaiv.Threading public static class ThreadExtensions { /// Gets the value of T. - [SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "thread", - Justification = "ThreadDomain works per thread, and with this extension method, the behavior is virtually extended to System.Threading.Thread.")] - public static T GetValue(this Thread thread) - { - return ThreadDomain.Current.Get(); - } + public static T GetValue(this Thread thread) => ThreadDomain.Current.Get(); /// Sets the value for T. - [SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "thread", - Justification = "ThreadDomain works per thread, and with this extension method, the behavior is virtually extended to System.Threading.Thread.")] - public static void SetValue(this Thread thread, T value) - { - ThreadDomain.Current.Set(value); - } + public static void SetValue(this Thread thread, T value) => ThreadDomain.Current.Set(value); /// Removes the value of T. - [SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "thread", - Justification = "ThreadDomain works per thread, and with this extension method, the behavior is virtually extended to System.Threading.Thread.")] - public static void RemoveValue(this Thread thread, Type type) - { - ThreadDomain.Current.Remove(type); - } + public static void RemoveValue(this Thread thread, Type type) => ThreadDomain.Current.Remove(type); } } diff --git a/src/Qowaiv/Uuid.cs b/src/Qowaiv/Uuid.cs index 499b83437..89c1152f4 100644 --- a/src/Qowaiv/Uuid.cs +++ b/src/Qowaiv/Uuid.cs @@ -60,7 +60,7 @@ public struct Uuid : ISerializable, IXmlSerializable, IJsonSerializable, IFormat #region Methods /// Returns true if the UUID is empty, otherwise false. - public bool IsEmpty() => m_Value == default(Guid); + public bool IsEmpty() => m_Value == default; /// Returns a 16-element byte array that contains the value of this instance. public byte[] ToByteArray() => m_Value.ToByteArray(); @@ -122,7 +122,7 @@ void IXmlSerializable.WriteXml(XmlWriter writer) #region (JSON) (De)serialization /// Generates a UUID from a JSON null object representation. - void IJsonSerializable.FromJson() => m_Value = default(Guid); + void IJsonSerializable.FromJson() => m_Value = default; /// Generates a UUID from a JSON string representation. /// @@ -150,7 +150,7 @@ void IXmlSerializable.WriteXml(XmlWriter writer) /// Converts a UUID into its JSON object representation. - object IJsonSerializable.ToJson() => m_Value == default(Guid) ? null : ToString(CultureInfo.InvariantCulture); + object IJsonSerializable.ToJson() => m_Value == default ? null : ToString(CultureInfo.InvariantCulture); #endregion diff --git a/src/Qowaiv.Web/InternetMediaSuffixType .cs b/src/Qowaiv/Web/InternetMediaSuffixType .cs similarity index 100% rename from src/Qowaiv.Web/InternetMediaSuffixType .cs rename to src/Qowaiv/Web/InternetMediaSuffixType .cs diff --git a/src/Qowaiv.Web/InternetMediaTopLevelType.cs b/src/Qowaiv/Web/InternetMediaTopLevelType.cs similarity index 100% rename from src/Qowaiv.Web/InternetMediaTopLevelType.cs rename to src/Qowaiv/Web/InternetMediaTopLevelType.cs diff --git a/src/Qowaiv.Web/InternetMediaType.FromFile.resx b/src/Qowaiv/Web/InternetMediaType.FromFile.resx similarity index 95% rename from src/Qowaiv.Web/InternetMediaType.FromFile.resx rename to src/Qowaiv/Web/InternetMediaType.FromFile.resx index 8315c8230..6c383f9d4 100644 --- a/src/Qowaiv.Web/InternetMediaType.FromFile.resx +++ b/src/Qowaiv/Web/InternetMediaType.FromFile.resx @@ -4,868 +4,868 @@ 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - application/acad - - - application/astound - - - application/astound - - - application/clariscad - - - application/drafting - - - application/dxf - - - application/envoy - - - application/fractals - - - application/futuresplash - - - application/hta - - - application/i-deas - - - application/iges - - - application/iges - - - application/internet-property-stream - - - application/java-archive - - - application/javascript - - - application/mac-binhex40 - - - application/msword - - - application/msword - - - application/msword - - - application/msword - - - application/octet-stream - - - application/octet-stream - - - application/octet-stream - - - application/octet-stream - - - application/oda - - - application/olescript - - - application/pdf - - - application/pics-rules - - - application/pkcs10 - - - application/pkix-crl - - - application/postscript - - - application/postscript - - - application/postscript - - - application/pro_eng - - - application/pro_eng - - - application/rtf - - - application/set - - - application/set-payment-initiation - - - application/set-registration-initiation - - - application/solids - - - application/vda - - - application/vnd.android.package-archive - - - application/vnd.ms-cab-compressed - - - application/vnd.ms-excel - - - application/vnd.ms-excel - - - application/vnd.ms-excel - - - application/vnd.ms-excel - - - application/vnd.ms-excel - - - application/vnd.ms-excel - - - application/vnd.ms-outlook - - - application/vnd.ms-pkicertstore - - - application/vnd.ms-pkiseccat - - - application/vnd.ms-pkistl - - - application/vnd.ms-powerpoint - - - application/vnd.ms-powerpoint - - - application/vnd.ms-powerpoint - - - application/vnd.ms-project - - - application/vnd.ms-works - - - application/vnd.ms-works - - - application/vnd.ms-works - - - application/vnd.ms-works - - - application/vnd.oasis.opendocument.chart - - - application/vnd.oasis.opendocument.database - - - application/vnd.oasis.opendocument.formula - - - application/vnd.oasis.opendocument.graphics - - - application/vnd.oasis.opendocument.graphics-template - - - application/vnd.oasis.opendocument.image - - - application/vnd.oasis.opendocument.presentation - - - application/vnd.oasis.opendocument.presentation-template - - - application/vnd.oasis.opendocument.spreadsheet - - - application/vnd.oasis.opendocument.spreadsheet-template - - - application/vnd.oasis.opendocument.text  - - - application/vnd.oasis.opendocument.text-master - - - application/vnd.oasis.opendocument.text-template - - - application/vnd.oasis.opendocument.text-web - - - application/vnd.openofficeorg.extension - - - application/vnd.stardivision.calc - - - application/vnd.stardivision.chart - - - application/vnd.stardivision.draw - - - application/vnd.stardivision.impress - - - application/vnd.stardivision.impress-packed - - - application/vnd.stardivision.mail - - - application/vnd.stardivision.math - - - application/vnd.stardivision.writer - - - application/vnd.stardivision.writer-global - - - application/vnd.sun.xml.calc - - - application/vnd.sun.xml.calc.template - - - application/vnd.sun.xml.draw - - - application/vnd.sun.xml.draw.template - - - application/vnd.sun.xml.impress - - - application/vnd.sun.xml.impress.template - - - application/vnd.sun.xml.math - - - application/vnd.sun.xml.writer - - - application/vnd.sun.xml.writer.global - - - application/vnd.sun.xml.writer.template - - - application/winhlp - - - application/x-7z-compressed - - - application/x-7z-compressed - - - application/x-ace-compressed - - - application/x-alz-compressed - - - application/x-apple-diskimage - - - application/x-arj - - - application/x-astrotite-afa - - - application/x-b1 - - - application/x-bcpio - - - application/x-bzip2 - - - application/x-netcdf - - - application/x-cfs-compressed - - - application/x-chess-pgn - - - application/x-compress - - - application/x-cpio - - - application/x-csh - - - application/x-dar - - - application/x-dgc-compressed - - - application/x-director - - - application/x-director - - - application/x-director - - - application/x-dvi - - - application/x-dwf - - - application/x-font-ttf - - - application/x-gca-compressed - - - application/x-gtar - - - application/x-gtar - - - application/x-gtar - - - application/x-gtar - - - application/x-gtar - - - application/x-gtar - - - application/x-gtar - - - application/x-gtar - - - application/x-gzip - - - application/x-gzip - - - application/x-hdf - - - application/x-internet-signup - - - application/x-internet-signup - - - application/x-iphone - - - application/x-latex - - - application/x-latex - - - application/x-lzh - - - application/x-lzh - - - application/x-lzip - - - application/x-lzma - - - application/x-lzop - - - application/x-lzx - - - application/x-mif - - - application/x-msaccess - - - application/x-mscardfile - - - application/x-msclip - - - application/x-msdownload - - - application/x-msmediaview - - - application/x-msmediaview - - - application/x-msmediaview - - - application/x-msmetafile - - - application/x-msmoney - - - application/x-mspublisher - - - application/x-msschedule - - - application/x-msterminal - - - application/x-mswrite - - - application/x-netcdf - - - application/x-par2 - - - application/x-par2 - - - application/x-perfmon - - - application/x-perfmon - - - application/x-perfmon - - - application/x-perfmon - - - application/x-perfmon - - - application/x-pkcs12 - - - application/x-pkcs12 - - - application/x-pkcs7-certificates - - - application/x-pkcs7-certificates - - - application/x-pkcs7-certreqresp - - - application/x-pkcs7-mime - - - application/x-pkcs7-mime - - - application/x-pkcs7-signature - - - application/x-rar-compressed - - - application/x-sh - - - application/x-shar - - - application/x-shockwave-flash - - - application/x-stuffit - - - application/x-stuffitx - - - application/x-sv4cpio - - - application/x-sv4crc - - - application/x-tar - - - application/x-tcl - - - application/x-texinfo - - - application/x-texinfo - - - application/x-troff - - - application/x-troff - - - application/x-troff - - - application/x-troff-man - - - application/x-troff-me - - - application/x-troff-ms - - - application/x-ustar - - - application/x-wais-source - - - application/x-x509-ca-cert - - - application/x-x509-ca-cert - - - application/x-x509-ca-cert - - - application/x-xz - - - application/x-zoo - - - application/ynd.ms-pkipko - - - application/zip - - - application/zip - - - audio/basic - - - audio/basic - - - audio/mid - - - audio/mid - - - audio/midi - - - audio/mpeg - - - audio/x-aiff - - - audio/x-aiff - - - audio/x-aiff - - - audio/x-mpegurl - - - audio/x-pn-realaudio - - - audio/x-pn-realaudio - - - audio/x-pn-realaudio-plugin - - - audio/x-voice - - - audio/x-wav - - - image/bmp - - - image/cis-cod - - - image/gif - - - image/ief - - - image/jpeg - - - image/jpeg - - - image/jpeg - - - image/pict - - - image/pipeg - - - image/png - - - image/svg+xml - - - image/tiff - - - image/tiff - - - image/x-cmu-raster - - - image/x-cmx - - - image/x-icon - - - image/x-portable-anymap - - - image/x-portable-bitmap - - - image/x-portable-graymap - - - image/x-portable-pixmap - - - image/x-rgb - - - image/x-xbitmap - - - image/x-xpixmap - - - image/x-xwindowdump - - - message/rfc822 - - - message/rfc822 - - - message/rfc822 - - - text/css - - - text/h323 - - - text/html - - - text/html - - - text/html - - - text/iuls - - - text/plain - - - text/plain - - - text/plain - - - text/plain - - - text/richtext - - - text/scriptlet - - - text/tab-separated-values - - - text/webviewhtml - - - text/x-component - - - text/x-markdown - - - text/x-setext - - - text/x-sgml - - - text/x-sgml - - - text/x-vcard - - - video/mpeg - - - video/mpeg - - - video/mpeg - - - video/mpeg - - - video/mpeg - - - video/mpeg - - - video/quicktime - - - video/quicktime - - - video/vdo - - - video/vivo - - - video/vivo - - - video/x-la-asf - - - video/x-la-asf - - - video/x-ms-asf - - - video/x-ms-asf - - - video/x-ms-asf - - - video/x-msvideo - - - video/x-sgi-movie - - - image/jp2 - - - image/jp2 - - - image/jpm - - - video/mj2 - - - image/jpx - - - video/mj2 - + + application/acad + + + application/astound + + + application/astound + + + application/clariscad + + + application/drafting + + + application/dxf + + + application/envoy + + + application/fractals + + + application/futuresplash + + + application/hta + + + application/i-deas + + + application/iges + + + application/iges + + + application/internet-property-stream + + + application/java-archive + + + application/javascript + + + application/mac-binhex40 + + + application/msword + + + application/msword + + + application/msword + + + application/msword + + + application/octet-stream + + + application/octet-stream + + + application/octet-stream + + + application/octet-stream + + + application/oda + + + application/olescript + + + application/pdf + + + application/pics-rules + + + application/pkcs10 + + + application/pkix-crl + + + application/postscript + + + application/postscript + + + application/postscript + + + application/pro_eng + + + application/pro_eng + + + application/rtf + + + application/set + + + application/set-payment-initiation + + + application/set-registration-initiation + + + application/solids + + + application/vda + + + application/vnd.android.package-archive + + + application/vnd.ms-cab-compressed + + + application/vnd.ms-excel + + + application/vnd.ms-excel + + + application/vnd.ms-excel + + + application/vnd.ms-excel + + + application/vnd.ms-excel + + + application/vnd.ms-excel + + + application/vnd.ms-outlook + + + application/vnd.ms-pkicertstore + + + application/vnd.ms-pkiseccat + + + application/vnd.ms-pkistl + + + application/vnd.ms-powerpoint + + + application/vnd.ms-powerpoint + + + application/vnd.ms-powerpoint + + + application/vnd.ms-project + + + application/vnd.ms-works + + + application/vnd.ms-works + + + application/vnd.ms-works + + + application/vnd.ms-works + + + application/vnd.oasis.opendocument.chart + + + application/vnd.oasis.opendocument.database + + + application/vnd.oasis.opendocument.formula + + + application/vnd.oasis.opendocument.graphics + + + application/vnd.oasis.opendocument.graphics-template + + + application/vnd.oasis.opendocument.image + + + application/vnd.oasis.opendocument.presentation + + + application/vnd.oasis.opendocument.presentation-template + + + application/vnd.oasis.opendocument.spreadsheet + + + application/vnd.oasis.opendocument.spreadsheet-template + + + application/vnd.oasis.opendocument.text  + + + application/vnd.oasis.opendocument.text-master + + + application/vnd.oasis.opendocument.text-template + + + application/vnd.oasis.opendocument.text-web + + + application/vnd.openofficeorg.extension + + + application/vnd.stardivision.calc + + + application/vnd.stardivision.chart + + + application/vnd.stardivision.draw + + + application/vnd.stardivision.impress + + + application/vnd.stardivision.impress-packed + + + application/vnd.stardivision.mail + + + application/vnd.stardivision.math + + + application/vnd.stardivision.writer + + + application/vnd.stardivision.writer-global + + + application/vnd.sun.xml.calc + + + application/vnd.sun.xml.calc.template + + + application/vnd.sun.xml.draw + + + application/vnd.sun.xml.draw.template + + + application/vnd.sun.xml.impress + + + application/vnd.sun.xml.impress.template + + + application/vnd.sun.xml.math + + + application/vnd.sun.xml.writer + + + application/vnd.sun.xml.writer.global + + + application/vnd.sun.xml.writer.template + + + application/winhlp + + + application/x-7z-compressed + + + application/x-7z-compressed + + + application/x-ace-compressed + + + application/x-alz-compressed + + + application/x-apple-diskimage + + + application/x-arj + + + application/x-astrotite-afa + + + application/x-b1 + + + application/x-bcpio + + + application/x-bzip2 + + + application/x-netcdf + + + application/x-cfs-compressed + + + application/x-chess-pgn + + + application/x-compress + + + application/x-cpio + + + application/x-csh + + + application/x-dar + + + application/x-dgc-compressed + + + application/x-director + + + application/x-director + + + application/x-director + + + application/x-dvi + + + application/x-dwf + + + application/x-font-ttf + + + application/x-gca-compressed + + + application/x-gtar + + + application/x-gtar + + + application/x-gtar + + + application/x-gtar + + + application/x-gtar + + + application/x-gtar + + + application/x-gtar + + + application/x-gtar + + + application/x-gzip + + + application/x-gzip + + + application/x-hdf + + + application/x-internet-signup + + + application/x-internet-signup + + + application/x-iphone + + + application/x-latex + + + application/x-latex + + + application/x-lzh + + + application/x-lzh + + + application/x-lzip + + + application/x-lzma + + + application/x-lzop + + + application/x-lzx + + + application/x-mif + + + application/x-msaccess + + + application/x-mscardfile + + + application/x-msclip + + + application/x-msdownload + + + application/x-msmediaview + + + application/x-msmediaview + + + application/x-msmediaview + + + application/x-msmetafile + + + application/x-msmoney + + + application/x-mspublisher + + + application/x-msschedule + + + application/x-msterminal + + + application/x-mswrite + + + application/x-netcdf + + + application/x-par2 + + + application/x-par2 + + + application/x-perfmon + + + application/x-perfmon + + + application/x-perfmon + + + application/x-perfmon + + + application/x-perfmon + + + application/x-pkcs12 + + + application/x-pkcs12 + + + application/x-pkcs7-certificates + + + application/x-pkcs7-certificates + + + application/x-pkcs7-certreqresp + + + application/x-pkcs7-mime + + + application/x-pkcs7-mime + + + application/x-pkcs7-signature + + + application/x-rar-compressed + + + application/x-sh + + + application/x-shar + + + application/x-shockwave-flash + + + application/x-stuffit + + + application/x-stuffitx + + + application/x-sv4cpio + + + application/x-sv4crc + + + application/x-tar + + + application/x-tcl + + + application/x-texinfo + + + application/x-texinfo + + + application/x-troff + + + application/x-troff + + + application/x-troff + + + application/x-troff-man + + + application/x-troff-me + + + application/x-troff-ms + + + application/x-ustar + + + application/x-wais-source + + + application/x-x509-ca-cert + + + application/x-x509-ca-cert + + + application/x-x509-ca-cert + + + application/x-xz + + + application/x-zoo + + + application/ynd.ms-pkipko + + + application/zip + + + application/zip + + + audio/basic + + + audio/basic + + + audio/mid + + + audio/mid + + + audio/midi + + + audio/mpeg + + + audio/x-aiff + + + audio/x-aiff + + + audio/x-aiff + + + audio/x-mpegurl + + + audio/x-pn-realaudio + + + audio/x-pn-realaudio + + + audio/x-pn-realaudio-plugin + + + audio/x-voice + + + audio/x-wav + + + image/bmp + + + image/cis-cod + + + image/gif + + + image/ief + + + image/jpeg + + + image/jpeg + + + image/jpeg + + + image/pict + + + image/pipeg + + + image/png + + + image/svg+xml + + + image/tiff + + + image/tiff + + + image/x-cmu-raster + + + image/x-cmx + + + image/x-icon + + + image/x-portable-anymap + + + image/x-portable-bitmap + + + image/x-portable-graymap + + + image/x-portable-pixmap + + + image/x-rgb + + + image/x-xbitmap + + + image/x-xpixmap + + + image/x-xwindowdump + + + message/rfc822 + + + message/rfc822 + + + message/rfc822 + + + text/css + + + text/h323 + + + text/html + + + text/html + + + text/html + + + text/iuls + + + text/plain + + + text/plain + + + text/plain + + + text/plain + + + text/richtext + + + text/scriptlet + + + text/tab-separated-values + + + text/webviewhtml + + + text/x-component + + + text/x-markdown + + + text/x-setext + + + text/x-sgml + + + text/x-sgml + + + text/x-vcard + + + video/mpeg + + + video/mpeg + + + video/mpeg + + + video/mpeg + + + video/mpeg + + + video/mpeg + + + video/quicktime + + + video/quicktime + + + video/vdo + + + video/vivo + + + video/vivo + + + video/x-la-asf + + + video/x-la-asf + + + video/x-ms-asf + + + video/x-ms-asf + + + video/x-ms-asf + + + video/x-msvideo + + + video/x-sgi-movie + + + image/jp2 + + + image/jp2 + + + image/jpm + + + video/mj2 + + + image/jpx + + + video/mj2 + \ No newline at end of file diff --git a/src/Qowaiv.Web/InternetMediaType.cs b/src/Qowaiv/Web/InternetMediaType.cs similarity index 98% rename from src/Qowaiv.Web/InternetMediaType.cs rename to src/Qowaiv/Web/InternetMediaType.cs index 89968bc1f..5acfebe5b 100644 --- a/src/Qowaiv.Web/InternetMediaType.cs +++ b/src/Qowaiv/Web/InternetMediaType.cs @@ -6,9 +6,9 @@ // "GetHashCode" should not reference mutable fields // See README.md => Hashing +using Qowaiv.Conversion.Web; using Qowaiv.Formatting; using Qowaiv.Json; -using Qowaiv.Web.Conversion; using System; using System.ComponentModel; using System.Diagnostics; @@ -154,7 +154,7 @@ public bool IsRegistered #region Methods /// Returns true if the Internet media type is empty, otherwise false. - public bool IsEmpty() => m_Value == default(string); + public bool IsEmpty() => m_Value == default; /// Returns true if the Internet media type is unknown, otherwise false. public bool IsUnknown() { return m_Value == InternetMediaType.Unknown.m_Value; } @@ -219,10 +219,7 @@ void IXmlSerializable.WriteXml(XmlWriter writer) #region (JSON) (De)serialization /// Generates an Internet media type from a JSON null object representation. - void IJsonSerializable.FromJson() - { - m_Value = default(string); - } + void IJsonSerializable.FromJson() => m_Value = default; /// Generates an Internet media type from a JSON string representation. /// @@ -252,10 +249,7 @@ void IJsonSerializable.FromJson(string jsonString) void IJsonSerializable.FromJson(DateTime jsonDate) => throw new NotSupportedException(QowaivMessages.JsonSerialization_DateTimeNotSupported); /// Converts an Internet media type into its JSON object representation. - object IJsonSerializable.ToJson() - { - return m_Value == default(string) ? null : ToString(CultureInfo.InvariantCulture); - } + object IJsonSerializable.ToJson()=> m_Value == default ? null : ToString(CultureInfo.InvariantCulture); #endregion @@ -419,7 +413,7 @@ public static InternetMediaType Parse(string s) { return val; } - throw new FormatException(QowaivWebMessages.FormatExceptionInternetMediaType); + throw new FormatException(QowaivMessages.FormatExceptionInternetMediaType); } /// Converts the string to an Internet media type. diff --git a/src/Qowaiv/Year.cs b/src/Qowaiv/Year.cs index cbe9e435e..e37f6349c 100644 --- a/src/Qowaiv/Year.cs +++ b/src/Qowaiv/Year.cs @@ -59,7 +59,7 @@ public bool IsLeapYear #region Methods /// Returns true if the year is empty, otherwise false. - public bool IsEmpty() => m_Value == default(short); + public bool IsEmpty() => m_Value == default; /// Returns true if the year is unknown, otherwise false. public bool IsUnknown() => m_Value == Unknown.m_Value; diff --git a/src/Qowaiv/YesNo.cs b/src/Qowaiv/YesNo.cs index dffef7d66..6849f184c 100644 --- a/src/Qowaiv/YesNo.cs +++ b/src/Qowaiv/YesNo.cs @@ -60,7 +60,7 @@ public struct YesNo : ISerializable, IXmlSerializable, IJsonSerializable, IForma #region Methods /// Returns true if the Yes-no is empty, otherwise false. - public bool IsEmpty() => m_Value == default(byte); + public bool IsEmpty() => m_Value == default; /// Returns true if the Yes-no is unknown, otherwise false. public bool IsUnknown() => m_Value == Unknown.m_Value; @@ -131,7 +131,7 @@ void IXmlSerializable.WriteXml(XmlWriter writer) #region (JSON) (De)serialization /// Generates a Yes-no from a JSON null object representation. - void IJsonSerializable.FromJson() => m_Value = default(byte); + void IJsonSerializable.FromJson() => m_Value = default; /// Generates a Yes-no from a JSON string representation. /// diff --git a/test/Qowaiv.ComponentModel.UnitTests/Rules/DummyRule.cs b/test/Qowaiv.ComponentModel.UnitTests/Rules/DummyRule.cs deleted file mode 100644 index 5f53f3f66..000000000 --- a/test/Qowaiv.ComponentModel.UnitTests/Rules/DummyRule.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Qowaiv.ComponentModel.Rules; -using System.ComponentModel.DataAnnotations; - -namespace Qowaiv.ComponentModel.UnitTests.Rules -{ - public class DummyRule : ValidationRule - { - public DummyRule(): base("Dummy") - { - ErrorMessageResourceType = typeof(TestMessages); - ErrorMessageResourceName = "TestError"; - } - protected override bool IsValid(ValidationContext validationContext) => false; - } -} diff --git a/test/Qowaiv.ComponentModel.UnitTests/Rules/ValidationRuleTest.cs b/test/Qowaiv.ComponentModel.UnitTests/Rules/ValidationRuleTest.cs deleted file mode 100644 index 52cbc7bca..000000000 --- a/test/Qowaiv.ComponentModel.UnitTests/Rules/ValidationRuleTest.cs +++ /dev/null @@ -1,20 +0,0 @@ -using NUnit.Framework; -using Qowaiv.Globalization; - -namespace Qowaiv.ComponentModel.UnitTests.Rules -{ - public class ValidationRuleTest - { - [Test] - public void Validate_DummyRule_CustomizedDutchMessage() - { - using (new CultureInfoScope("nl-NL")) - { - var rule = new DummyRule(); - var act = rule.Validate(null).ToString(); - var exp = "Dummy is fout."; - Assert.AreEqual(exp, act); - } - } - } -} diff --git a/test/Qowaiv.ComponentModel.UnitTests/Validation/DataAnnotationsValidatorTest.cs b/test/Qowaiv.ComponentModel.UnitTests/Validation/DataAnnotationsValidatorTest.cs index c5e366102..a815e67c0 100644 --- a/test/Qowaiv.ComponentModel.UnitTests/Validation/DataAnnotationsValidatorTest.cs +++ b/test/Qowaiv.ComponentModel.UnitTests/Validation/DataAnnotationsValidatorTest.cs @@ -1,7 +1,6 @@ using NUnit.Framework; using Qowaiv.ComponentModel.Messages; using Qowaiv.ComponentModel.UnitTests.Validation.Models; -using Qowaiv.ComponentModel.Validation; using Qowaiv.Globalization; using Qowaiv.TestTools.ComponentModel; using System; @@ -73,70 +72,6 @@ public void Validate_ModelWithForbiddenValues_IsValid() DataAnnotationsAssert.IsValid(model); } - - [Test] - public void Validate_PostalCodeModel_Valid() - { - var model = new PostalCodeModel - { - Country = Country.NL, - PostalCode = PostalCode.Parse("2629 JD"), - }; - - DataAnnotationsAssert.IsValid(model); - } - - [Test] - public void Validate_PostalCodeModelWithEmptyValues_With2Errors() - { - var model = new PostalCodeModel - { - Country = Country.Empty, - PostalCode = PostalCode.Empty, - }; - - DataAnnotationsAssert.WithErrors(model, - ValidationMessage.Error("The Country field is required.", "Country"), - ValidationMessage.Error("The PostalCode field is required.", "PostalCode") - ); - } - - [Test] - public void Validate_PostalCodeModelWithInvalidPostalCode_WithError() - { - using (new CultureInfoScope("nl-BE")) - { - var model = new PostalCodeModel - { - Country = Country.BE, - PostalCode = PostalCode.Parse("2629 JD"), - }; - - DataAnnotationsAssert.WithErrors(model, - ValidationMessage.Error("De postcode 2629JD is niet geldig voor België.", "PostalCode", "Country") - ); - } - } - - [Test] - public void Validate_PostalCodeModelWithErrorByService_WithError() - { - var validator = new AnnotatedModelValidator(new TestServiceProvider - { - { typeof(AddressService), new AddressService() }, - }); - - var model = new PostalCodeModel - { - Country = Country.NL, - PostalCode = PostalCode.Parse("2629 XP"), - }; - - DataAnnotationsAssert.WithErrors(model, validator, - ValidationMessage.Error("Postal code does not exist.", "PostalCode") - ); - } - [Test] public void Validate_ModelWithCustomizedResource_WithError() { diff --git a/test/Qowaiv.ComponentModel.UnitTests/Validation/Models/PostalCodeModel.cs b/test/Qowaiv.ComponentModel.UnitTests/Validation/Models/PostalCodeModel.cs deleted file mode 100644 index 72847d37e..000000000 --- a/test/Qowaiv.ComponentModel.UnitTests/Validation/Models/PostalCodeModel.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Qowaiv.ComponentModel.DataAnnotations; -using Qowaiv.ComponentModel.Rules; -using Qowaiv.ComponentModel.Rules.Globalization; -using Qowaiv.Globalization; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; - -namespace Qowaiv.ComponentModel.UnitTests.Validation.Models -{ - public class PostalCodeModel : IValidatableObject - { - [Mandatory] - public Country Country { get; set; } - - [Mandatory] - public PostalCode PostalCode { get; set; } - - public IEnumerable Validate(ValidationContext validationContext) - { - return ValidationRules.Validate(validationContext, - new PostalCodeRule(PostalCode, Country, nameof(PostalCode), nameof(Country)), - - ValidationRule.For( - (cxt) => cxt.GetSevice()?.PostalCodeExists(PostalCode), - ()=> "Postal code does not exist.", - nameof(PostalCode))); - } - } - public class AddressService - { - public bool PostalCodeExists(PostalCode code) => code == PostalCode.Parse("2629 JD"); - } -} diff --git a/test/Qowaiv.Data.SqlClient.UnitTests/Sql/TimestampTest.cs b/test/Qowaiv.Data.SqlClient.UnitTests/Sql/TimestampTest.cs index 0bcfafa67..e251bbef1 100644 --- a/test/Qowaiv.Data.SqlClient.UnitTests/Sql/TimestampTest.cs +++ b/test/Qowaiv.Data.SqlClient.UnitTests/Sql/TimestampTest.cs @@ -166,7 +166,7 @@ public void Constructor_SerializationInfoIsNull_ThrowsArgumentNullException() ExceptionAssert.CatchArgumentNullException (() => { - SerializationTest.DeserializeUsingConstructor(null, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(null, default); }, "info"); } @@ -178,7 +178,7 @@ public void Constructor_InvalidSerializationInfo_ThrowsSerializationException() (() => { var info = new SerializationInfo(typeof(Timestamp), new System.Runtime.Serialization.FormatterConverter()); - SerializationTest.DeserializeUsingConstructor(info, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(info, default); }); } @@ -189,7 +189,7 @@ public void GetObjectData_Null_ThrowsArgumentNullException() (() => { ISerializable obj = TestStruct; - obj.GetObjectData(null, default(StreamingContext)); + obj.GetObjectData(null, default); }, "info"); } @@ -199,7 +199,7 @@ public void GetObjectData_SerializationInfo_AreEqual() { ISerializable obj = TestStruct; var info = new SerializationInfo(typeof(Timestamp), new System.Runtime.Serialization.FormatterConverter()); - obj.GetObjectData(info, default(StreamingContext)); + obj.GetObjectData(info, default); Assert.AreEqual((Int64)123456789, info.GetInt64("Value")); } diff --git a/test/Qowaiv.UnitTests/AssemblyTest.cs b/test/Qowaiv.UnitTests/AssemblyTest.cs index ec661bd28..383d11171 100644 --- a/test/Qowaiv.UnitTests/AssemblyTest.cs +++ b/test/Qowaiv.UnitTests/AssemblyTest.cs @@ -35,9 +35,9 @@ public void ContainsSvos_None() typeof(Globalization.Country), typeof(IO.StreamSize), typeof(Security.Cryptography.CryptographicSeed), - typeof(Statistics.Elo) + typeof(Statistics.Elo), + typeof(Web.InternetMediaType) ); } - } } diff --git a/test/Qowaiv.UnitTests/DateTest.cs b/test/Qowaiv.UnitTests/DateTest.cs index 59ad98b5a..5ef48de81 100644 --- a/test/Qowaiv.UnitTests/DateTest.cs +++ b/test/Qowaiv.UnitTests/DateTest.cs @@ -142,7 +142,7 @@ public void Constructor_SerializationInfoIsNull_ThrowsArgumentNullException() ExceptionAssert.CatchArgumentNullException (() => { - SerializationTest.DeserializeUsingConstructor(null, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(null, default); }, "info"); } @@ -154,7 +154,7 @@ public void Constructor_InvalidSerializationInfo_ThrowsSerializationException() (() => { var info = new SerializationInfo(typeof(Date), new System.Runtime.Serialization.FormatterConverter()); - SerializationTest.DeserializeUsingConstructor(info, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(info, default); }); } @@ -165,7 +165,7 @@ public void GetObjectData_Null_ThrowsArgumentNullException() (() => { ISerializable obj = TestStruct; - obj.GetObjectData(null, default(StreamingContext)); + obj.GetObjectData(null, default); }, "info"); } @@ -175,7 +175,7 @@ public void GetObjectData_SerializationInfo_AreEqual() { ISerializable obj = TestStruct; var info = new SerializationInfo(typeof(Date), new System.Runtime.Serialization.FormatterConverter()); - obj.GetObjectData(info, default(StreamingContext)); + obj.GetObjectData(info, default); Assert.AreEqual(new DateTime(1970, 02, 14), info.GetDateTime("Value")); } diff --git a/test/Qowaiv.UnitTests/EmailAddressCollectionTest.cs b/test/Qowaiv.UnitTests/EmailAddressCollectionTest.cs index 2365a8b84..9cf775fa7 100644 --- a/test/Qowaiv.UnitTests/EmailAddressCollectionTest.cs +++ b/test/Qowaiv.UnitTests/EmailAddressCollectionTest.cs @@ -37,7 +37,7 @@ public void Constructor_SerializationInfoIsNull_ThrowsArgumentNullException() ExceptionAssert.CatchArgumentNullException (() => { - SerializationTest.DeserializeUsingConstructor(null, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(null, default); }, "info"); } @@ -49,7 +49,7 @@ public void Constructor_InvalidSerializationInfo_ThrowsSerializationException() (() => { var info = new SerializationInfo(typeof(EmailAddress), new System.Runtime.Serialization.FormatterConverter()); - SerializationTest.DeserializeUsingConstructor(info, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(info, default); }); } @@ -60,7 +60,7 @@ public void GetObjectData_Null_ThrowsArgumentNullException() (() => { ISerializable obj = GetTestInstance(); - obj.GetObjectData(null, default(StreamingContext)); + obj.GetObjectData(null, default); }, "info"); } @@ -70,7 +70,7 @@ public void GetObjectData_SerializationInfo_AreEqual() { ISerializable obj = GetTestInstance(); var info = new SerializationInfo(typeof(EmailAddressCollection), new System.Runtime.Serialization.FormatterConverter()); - obj.GetObjectData(info, default(StreamingContext)); + obj.GetObjectData(info, default); Assert.AreEqual("info@qowaiv.org,test@qowaiv.org", info.GetString("Value")); } diff --git a/test/Qowaiv.UnitTests/EmailAddressTest.cs b/test/Qowaiv.UnitTests/EmailAddressTest.cs index dc9d0c423..60a9ee054 100644 --- a/test/Qowaiv.UnitTests/EmailAddressTest.cs +++ b/test/Qowaiv.UnitTests/EmailAddressTest.cs @@ -224,7 +224,7 @@ public void Constructor_SerializationInfoIsNull_ThrowsArgumentNullException() ExceptionAssert.CatchArgumentNullException (() => { - SerializationTest.DeserializeUsingConstructor(null, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(null, default); }, "info"); } @@ -236,7 +236,7 @@ public void Constructor_InvalidSerializationInfo_ThrowsSerializationException() (() => { var info = new SerializationInfo(typeof(EmailAddress), new System.Runtime.Serialization.FormatterConverter()); - SerializationTest.DeserializeUsingConstructor(info, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(info, default); }); } @@ -247,7 +247,7 @@ public void GetObjectData_Null_ThrowsArgumentNullException() (() => { ISerializable obj = TestStruct; - obj.GetObjectData(null, default(StreamingContext)); + obj.GetObjectData(null, default); }, "info"); } @@ -257,7 +257,7 @@ public void GetObjectData_SerializationInfo_AreEqual() { ISerializable obj = TestStruct; var info = new SerializationInfo(typeof(EmailAddress), new System.Runtime.Serialization.FormatterConverter()); - obj.GetObjectData(info, default(StreamingContext)); + obj.GetObjectData(info, default); Assert.AreEqual("svo@qowaiv.org", info.GetString("Value")); } diff --git a/test/Qowaiv.UnitTests/Financial/AmountTest.cs b/test/Qowaiv.UnitTests/Financial/AmountTest.cs index 3f44bacaf..69061212f 100644 --- a/test/Qowaiv.UnitTests/Financial/AmountTest.cs +++ b/test/Qowaiv.UnitTests/Financial/AmountTest.cs @@ -134,7 +134,7 @@ public void Constructor_SerializationInfoIsNull_ThrowsArgumentNullException() ExceptionAssert.CatchArgumentNullException (() => { - SerializationTest.DeserializeUsingConstructor(null, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(null, default); }, "info"); } @@ -146,7 +146,7 @@ public void Constructor_InvalidSerializationInfo_ThrowsSerializationException() (() => { var info = new SerializationInfo(typeof(Amount), new System.Runtime.Serialization.FormatterConverter()); - SerializationTest.DeserializeUsingConstructor(info, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(info, default); }); } @@ -157,7 +157,7 @@ public void GetObjectData_Null_ThrowsArgumentNullException() (() => { ISerializable obj = TestStruct; - obj.GetObjectData(null, default(StreamingContext)); + obj.GetObjectData(null, default); }, "info"); } @@ -167,7 +167,7 @@ public void GetObjectData_SerializationInfo_AreEqual() { ISerializable obj = TestStruct; var info = new SerializationInfo(typeof(Amount), new FormatterConverter()); - obj.GetObjectData(info, default(StreamingContext)); + obj.GetObjectData(info, default); Assert.AreEqual(42.17m, info.GetDecimal("Value")); } diff --git a/test/Qowaiv.UnitTests/Financial/BankIdentifierCodeTest.cs b/test/Qowaiv.UnitTests/Financial/BankIdentifierCodeTest.cs index 7304feb69..84e7b5811 100644 --- a/test/Qowaiv.UnitTests/Financial/BankIdentifierCodeTest.cs +++ b/test/Qowaiv.UnitTests/Financial/BankIdentifierCodeTest.cs @@ -210,7 +210,7 @@ public void Constructor_SerializationInfoIsNull_ThrowsArgumentNullException() ExceptionAssert.CatchArgumentNullException (() => { - SerializationTest.DeserializeUsingConstructor(null, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(null, default); }, "info"); } @@ -222,7 +222,7 @@ public void Constructor_InvalidSerializationInfo_ThrowsSerializationException() (() => { var info = new SerializationInfo(typeof(BankIdentifierCode), new System.Runtime.Serialization.FormatterConverter()); - SerializationTest.DeserializeUsingConstructor(info, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(info, default); }); } @@ -233,7 +233,7 @@ public void GetObjectData_Null_ThrowsArgumentNullException() (() => { ISerializable obj = TestStruct; - obj.GetObjectData(null, default(StreamingContext)); + obj.GetObjectData(null, default); }, "info"); } @@ -243,7 +243,7 @@ public void GetObjectData_SerializationInfo_AreEqual() { ISerializable obj = TestStruct; var info = new SerializationInfo(typeof(BankIdentifierCode), new System.Runtime.Serialization.FormatterConverter()); - obj.GetObjectData(info, default(StreamingContext)); + obj.GetObjectData(info, default); Assert.AreEqual(TestStruct.ToString(), info.GetString("Value")); } diff --git a/test/Qowaiv.UnitTests/Financial/CurrencyTest.cs b/test/Qowaiv.UnitTests/Financial/CurrencyTest.cs index 93e09e3a2..cafb5b77b 100644 --- a/test/Qowaiv.UnitTests/Financial/CurrencyTest.cs +++ b/test/Qowaiv.UnitTests/Financial/CurrencyTest.cs @@ -270,7 +270,7 @@ public void Constructor_SerializationInfoIsNull_ThrowsArgumentNullException() ExceptionAssert.CatchArgumentNullException (() => { - SerializationTest.DeserializeUsingConstructor(null, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(null, default); }, "info"); } @@ -282,7 +282,7 @@ public void Constructor_InvalidSerializationInfo_ThrowsSerializationException() (() => { var info = new SerializationInfo(typeof(Currency), new System.Runtime.Serialization.FormatterConverter()); - SerializationTest.DeserializeUsingConstructor(info, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(info, default); }); } @@ -293,7 +293,7 @@ public void GetObjectData_Null_ThrowsArgumentNullException() (() => { ISerializable obj = TestStruct; - obj.GetObjectData(null, default(StreamingContext)); + obj.GetObjectData(null, default); }, "info"); } @@ -303,7 +303,7 @@ public void GetObjectData_SerializationInfo_AreEqual() { ISerializable obj = TestStruct; var info = new SerializationInfo(typeof(Currency), new System.Runtime.Serialization.FormatterConverter()); - obj.GetObjectData(info, default(StreamingContext)); + obj.GetObjectData(info, default); Assert.AreEqual("EUR", info.GetString("Value")); } diff --git a/test/Qowaiv.UnitTests/Financial/InternationalBankAccountNumberTest.cs b/test/Qowaiv.UnitTests/Financial/InternationalBankAccountNumberTest.cs index 727358b7b..c5a56092c 100644 --- a/test/Qowaiv.UnitTests/Financial/InternationalBankAccountNumberTest.cs +++ b/test/Qowaiv.UnitTests/Financial/InternationalBankAccountNumberTest.cs @@ -157,7 +157,7 @@ public void Constructor_SerializationInfoIsNull_ThrowsArgumentNullException() ExceptionAssert.CatchArgumentNullException (() => { - SerializationTest.DeserializeUsingConstructor(null, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(null, default); }, "info"); } @@ -169,7 +169,7 @@ public void Constructor_InvalidSerializationInfo_ThrowsSerializationException() (() => { var info = new SerializationInfo(typeof(InternationalBankAccountNumber), new System.Runtime.Serialization.FormatterConverter()); - SerializationTest.DeserializeUsingConstructor(info, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(info, default); }); } @@ -180,7 +180,7 @@ public void GetObjectData_Null_ThrowsArgumentNullException() (() => { ISerializable obj = TestStruct; - obj.GetObjectData(null, default(StreamingContext)); + obj.GetObjectData(null, default); }, "info"); } diff --git a/test/Qowaiv.UnitTests/Financial/MoneyTest.cs b/test/Qowaiv.UnitTests/Financial/MoneyTest.cs index 810060308..735709f70 100644 --- a/test/Qowaiv.UnitTests/Financial/MoneyTest.cs +++ b/test/Qowaiv.UnitTests/Financial/MoneyTest.cs @@ -126,7 +126,7 @@ public void Constructor_SerializationInfoIsNull_ThrowsArgumentNullException() ExceptionAssert.CatchArgumentNullException (() => { - SerializationTest.DeserializeUsingConstructor(null, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(null, default); }, "info"); } @@ -138,7 +138,7 @@ public void Constructor_InvalidSerializationInfo_ThrowsSerializationException() (() => { var info = new SerializationInfo(typeof(Money), new System.Runtime.Serialization.FormatterConverter()); - SerializationTest.DeserializeUsingConstructor(info, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(info, default); }); } @@ -149,7 +149,7 @@ public void GetObjectData_Null_ThrowsArgumentNullException() (() => { ISerializable obj = TestStruct; - obj.GetObjectData(null, default(StreamingContext)); + obj.GetObjectData(null, default); }, "info"); } @@ -159,7 +159,7 @@ public void GetObjectData_SerializationInfo_AreEqual() { ISerializable obj = TestStruct; var info = new SerializationInfo(typeof(Money), new FormatterConverter()); - obj.GetObjectData(info, default(StreamingContext)); + obj.GetObjectData(info, default); Assert.AreEqual(42.17m, info.GetDecimal("Value")); Assert.AreEqual("EUR", info.GetString("Currency")); diff --git a/test/Qowaiv.UnitTests/Formatting/FormattingArgumentsTest.cs b/test/Qowaiv.UnitTests/Formatting/FormattingArgumentsTest.cs index b66c1c304..254bb0501 100644 --- a/test/Qowaiv.UnitTests/Formatting/FormattingArgumentsTest.cs +++ b/test/Qowaiv.UnitTests/Formatting/FormattingArgumentsTest.cs @@ -79,7 +79,7 @@ public void Constructor_SerializationInfoIsNull_ThrowsArgumentNullException() ExceptionAssert.CatchArgumentNullException (() => { - SerializationTest.DeserializeUsingConstructor(null, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(null, default); }, "info"); } @@ -91,7 +91,7 @@ public void Constructor_InvalidSerializationInfo_ThrowsSerializationException() (() => { var info = new SerializationInfo(typeof(FormattingArguments), new System.Runtime.Serialization.FormatterConverter()); - SerializationTest.DeserializeUsingConstructor(info, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(info, default); }); } @@ -102,7 +102,7 @@ public void GetObjectData_Null_ThrowsArgumentNullException() (() => { ISerializable obj = TestStruct; - obj.GetObjectData(null, default(StreamingContext)); + obj.GetObjectData(null, default); }, "info"); } @@ -112,7 +112,7 @@ public void GetObjectData_SerializationInfo_AreEqual() { ISerializable obj = TestStruct; var info = new SerializationInfo(typeof(FormattingArguments), new System.Runtime.Serialization.FormatterConverter()); - obj.GetObjectData(info, default(StreamingContext)); + obj.GetObjectData(info, default); Assert.AreEqual("0.000", info.GetString("Format")); Assert.AreEqual(new CultureInfo("fr-BE"), info.GetValue("FormatProvider", typeof(IFormatProvider))); diff --git a/test/Qowaiv.UnitTests/GenderTest.cs b/test/Qowaiv.UnitTests/GenderTest.cs index 0b055dccf..3c6c1379b 100644 --- a/test/Qowaiv.UnitTests/GenderTest.cs +++ b/test/Qowaiv.UnitTests/GenderTest.cs @@ -251,7 +251,7 @@ public void Constructor_SerializationInfoIsNull_ThrowsArgumentNullException() ExceptionAssert.CatchArgumentNullException (() => { - SerializationTest.DeserializeUsingConstructor(null, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(null, default); }, "info"); } @@ -262,7 +262,7 @@ public void Constructor_InvalidSerializationInfo_ThrowsSerializationException() (() => { var info = new SerializationInfo(typeof(Gender), new System.Runtime.Serialization.FormatterConverter()); - SerializationTest.DeserializeUsingConstructor(info, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(info, default); }); } @@ -273,7 +273,7 @@ public void GetObjectData_Null_ThrowsArgumentNullException() (() => { ISerializable obj = TestStruct; - obj.GetObjectData(null, default(StreamingContext)); + obj.GetObjectData(null, default); }, "info"); } @@ -282,7 +282,7 @@ public void GetObjectData_SerializationInfo_AreEqual() { ISerializable obj = TestStruct; var info = new SerializationInfo(typeof(Gender), new System.Runtime.Serialization.FormatterConverter()); - obj.GetObjectData(info, default(StreamingContext)); + obj.GetObjectData(info, default); Assert.AreEqual((Byte)2, info.GetByte("Value")); } diff --git a/test/Qowaiv.UnitTests/Globalization/CountryTest.cs b/test/Qowaiv.UnitTests/Globalization/CountryTest.cs index cbb91179a..b1b8585cd 100644 --- a/test/Qowaiv.UnitTests/Globalization/CountryTest.cs +++ b/test/Qowaiv.UnitTests/Globalization/CountryTest.cs @@ -280,7 +280,7 @@ public void Constructor_SerializationInfoIsNull_ThrowsArgumentNullException() ExceptionAssert.CatchArgumentNullException (() => { - SerializationTest.DeserializeUsingConstructor(null, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(null, default); }, "info"); } @@ -292,7 +292,7 @@ public void Constructor_InvalidSerializationInfo_ThrowsSerializationException() (() => { var info = new SerializationInfo(typeof(Country), new System.Runtime.Serialization.FormatterConverter()); - SerializationTest.DeserializeUsingConstructor(info, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(info, default); }); } @@ -303,7 +303,7 @@ public void GetObjectData_Null_ThrowsArgumentNullException() (() => { ISerializable obj = TestStruct; - obj.GetObjectData(null, default(StreamingContext)); + obj.GetObjectData(null, default); }, "info"); } @@ -313,7 +313,7 @@ public void GetObjectData_SerializationInfo_AreEqual() { ISerializable obj = TestStruct; var info = new SerializationInfo(typeof(Country), new System.Runtime.Serialization.FormatterConverter()); - obj.GetObjectData(info, default(StreamingContext)); + obj.GetObjectData(info, default); Assert.AreEqual("VA", info.GetString("Value")); } diff --git a/test/Qowaiv.UnitTests/HouseNumberTest.cs b/test/Qowaiv.UnitTests/HouseNumberTest.cs index 3d94cebd9..3cf2c72cc 100644 --- a/test/Qowaiv.UnitTests/HouseNumberTest.cs +++ b/test/Qowaiv.UnitTests/HouseNumberTest.cs @@ -258,7 +258,7 @@ public void Constructor_SerializationInfoIsNull_ThrowsArgumentNullException() ExceptionAssert.CatchArgumentNullException (() => { - SerializationTest.DeserializeUsingConstructor(null, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(null, default); }, "info"); } @@ -270,7 +270,7 @@ public void Constructor_InvalidSerializationInfo_ThrowsSerializationException() (() => { var info = new SerializationInfo(typeof(HouseNumber), new System.Runtime.Serialization.FormatterConverter()); - SerializationTest.DeserializeUsingConstructor(info, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(info, default); }); } @@ -281,7 +281,7 @@ public void GetObjectData_Null_ThrowsArgumentNullException() (() => { ISerializable obj = TestStruct; - obj.GetObjectData(null, default(StreamingContext)); + obj.GetObjectData(null, default); }, "info"); } @@ -291,7 +291,7 @@ public void GetObjectData_SerializationInfo_AreEqual() { ISerializable obj = TestStruct; var info = new SerializationInfo(typeof(HouseNumber), new System.Runtime.Serialization.FormatterConverter()); - obj.GetObjectData(info, default(StreamingContext)); + obj.GetObjectData(info, default); Assert.AreEqual(123456789, info.GetInt32("Value")); } diff --git a/test/Qowaiv.UnitTests/IO/StreamSizeTest.cs b/test/Qowaiv.UnitTests/IO/StreamSizeTest.cs index 2c25adace..b50f1a055 100644 --- a/test/Qowaiv.UnitTests/IO/StreamSizeTest.cs +++ b/test/Qowaiv.UnitTests/IO/StreamSizeTest.cs @@ -174,7 +174,7 @@ public void Constructor_SerializationInfoIsNull_ThrowsArgumentNullException() ExceptionAssert.CatchArgumentNullException (() => { - SerializationTest.DeserializeUsingConstructor(null, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(null, default); }, "info"); } @@ -186,7 +186,7 @@ public void Constructor_InvalidSerializationInfo_ThrowsSerializationException() (() => { var info = new SerializationInfo(typeof(StreamSize), new System.Runtime.Serialization.FormatterConverter()); - SerializationTest.DeserializeUsingConstructor(info, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(info, default); }); } @@ -197,7 +197,7 @@ public void GetObjectData_Null_ThrowsArgumentNullException() (() => { ISerializable obj = TestStruct; - obj.GetObjectData(null, default(StreamingContext)); + obj.GetObjectData(null, default); }, "info"); } @@ -207,7 +207,7 @@ public void GetObjectData_SerializationInfo_AreEqual() { ISerializable obj = TestStruct; var info = new SerializationInfo(typeof(StreamSize), new System.Runtime.Serialization.FormatterConverter()); - obj.GetObjectData(info, default(StreamingContext)); + obj.GetObjectData(info, default); Assert.AreEqual((Int64)123456789, info.GetInt64("Value")); } diff --git a/test/Qowaiv.UnitTests/LocalDateTimeTest.cs b/test/Qowaiv.UnitTests/LocalDateTimeTest.cs index ae55d78ea..2c5627d20 100644 --- a/test/Qowaiv.UnitTests/LocalDateTimeTest.cs +++ b/test/Qowaiv.UnitTests/LocalDateTimeTest.cs @@ -128,7 +128,7 @@ public void Constructor_SerializationInfoIsNull_ThrowsArgumentNullException() ExceptionAssert.CatchArgumentNullException (() => { - SerializationTest.DeserializeUsingConstructor(null, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(null, default); }, "info"); } @@ -140,7 +140,7 @@ public void Constructor_InvalidSerializationInfo_ThrowsSerializationException() (() => { var info = new SerializationInfo(typeof(LocalDateTime), new System.Runtime.Serialization.FormatterConverter()); - SerializationTest.DeserializeUsingConstructor(info, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(info, default); }); } @@ -151,7 +151,7 @@ public void GetObjectData_Null_ThrowsArgumentNullException() (() => { ISerializable obj = TestStruct; - obj.GetObjectData(null, default(StreamingContext)); + obj.GetObjectData(null, default); }, "info"); } @@ -161,7 +161,7 @@ public void GetObjectData_SerializationInfo_AreEqual() { ISerializable obj = TestStruct; var info = new SerializationInfo(typeof(LocalDateTime), new System.Runtime.Serialization.FormatterConverter()); - obj.GetObjectData(info, default(StreamingContext)); + obj.GetObjectData(info, default); Assert.AreEqual(new DateTime(1988, 06, 13, 22, 10, 05, 001), info.GetDateTime("Value")); } diff --git a/test/Qowaiv.UnitTests/MonthTest.cs b/test/Qowaiv.UnitTests/MonthTest.cs index e5d98f682..e19dcd88a 100644 --- a/test/Qowaiv.UnitTests/MonthTest.cs +++ b/test/Qowaiv.UnitTests/MonthTest.cs @@ -303,7 +303,7 @@ public void Constructor_SerializationInfoIsNull_ThrowsArgumentNullException() ExceptionAssert.CatchArgumentNullException (() => { - SerializationTest.DeserializeUsingConstructor(null, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(null, default); }, "info"); } @@ -315,7 +315,7 @@ public void Constructor_InvalidSerializationInfo_ThrowsSerializationException() (() => { var info = new SerializationInfo(typeof(Month), new System.Runtime.Serialization.FormatterConverter()); - SerializationTest.DeserializeUsingConstructor(info, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(info, default); }); } @@ -326,7 +326,7 @@ public void GetObjectData_Null_ThrowsArgumentNullException() (() => { ISerializable obj = TestStruct; - obj.GetObjectData(null, default(StreamingContext)); + obj.GetObjectData(null, default); }, "info"); } @@ -336,7 +336,7 @@ public void GetObjectData_SerializationInfo_AreEqual() { ISerializable obj = TestStruct; var info = new SerializationInfo(typeof(Month), new System.Runtime.Serialization.FormatterConverter()); - obj.GetObjectData(info, default(StreamingContext)); + obj.GetObjectData(info, default); Assert.AreEqual((Byte)2, info.GetByte("Value")); } diff --git a/test/Qowaiv.UnitTests/PercentageTest.cs b/test/Qowaiv.UnitTests/PercentageTest.cs index 695ec4c64..3553cd9c5 100644 --- a/test/Qowaiv.UnitTests/PercentageTest.cs +++ b/test/Qowaiv.UnitTests/PercentageTest.cs @@ -211,7 +211,7 @@ public void Constructor_SerializationInfoIsNull_ThrowsArgumentNullException() ExceptionAssert.CatchArgumentNullException (() => { - SerializationTest.DeserializeUsingConstructor(null, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(null, default); }, "info"); } @@ -223,7 +223,7 @@ public void Constructor_InvalidSerializationInfo_ThrowsSerializationException() (() => { var info = new SerializationInfo(typeof(Percentage), new System.Runtime.Serialization.FormatterConverter()); - SerializationTest.DeserializeUsingConstructor(info, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(info, default); }); } @@ -234,7 +234,7 @@ public void GetObjectData_Null_ThrowsArgumentNullException() (() => { ISerializable obj = TestStruct; - obj.GetObjectData(null, default(StreamingContext)); + obj.GetObjectData(null, default); }, "info"); } @@ -244,7 +244,7 @@ public void GetObjectData_SerializationInfo_AreEqual() { ISerializable obj = TestStruct; var info = new SerializationInfo(typeof(Percentage), new System.Runtime.Serialization.FormatterConverter()); - obj.GetObjectData(info, default(StreamingContext)); + obj.GetObjectData(info, default); Assert.AreEqual(0.1751m, info.GetDecimal("Value")); } diff --git a/test/Qowaiv.UnitTests/PostalCodeCountryPatternTest.cs b/test/Qowaiv.UnitTests/PostalCodeCountryPatternTest.cs index b1aefb504..9356f536c 100644 --- a/test/Qowaiv.UnitTests/PostalCodeCountryPatternTest.cs +++ b/test/Qowaiv.UnitTests/PostalCodeCountryPatternTest.cs @@ -1,10 +1,3220 @@ -using NUnit.Framework; +#pragma warning disable S2699 // Tests should include assertions +// Calls IsNotValid with Assert methods. + +using NUnit.Framework; using Qowaiv.Globalization; namespace Qowaiv.UnitTests { public partial class PostalCodeTest { + #region IsNotValid Country tests + + /// Tests patterns that should not be valid for Andorra (AD). + [Test] + public void IsNotValidCustomCases_AD_All() + { + var country = Country.AD; + + IsNotValid("AD890", country); + IsNotValid("AD901", country); + IsNotValid("AD012", country); + } + + /// Tests patterns that should not be valid for Afghanistan (AF). + [Test] + public void IsNotValidCustomCases_AF_All() + { + var country = Country.AF; + + IsNotValid("0077", country); + IsNotValid("5301", country); + IsNotValid("6001", country); + IsNotValid("7023", country); + IsNotValid("8100", country); + IsNotValid("9020", country); + IsNotValid("4441", country); + IsNotValid("4300", country); + } + + /// Tests patterns that should not be valid for Anguilla (AI). + [Test] + public void IsNotValidCustomCases_AI_All() + { + var country = Country.AI; + + IsNotValid("9218", country); + IsNotValid("AI1890", country); + IsNotValid("AI2901", country); + IsNotValid("AI2012", country); + } + + /// Tests patterns that should not be valid for Albania (AL). + [Test] + public void IsNotValidCustomCases_AL_All() + { + var country = Country.AL; + + IsNotValid("0000", country); + IsNotValid("0125", country); + IsNotValid("0279", country); + IsNotValid("0399", country); + IsNotValid("0418", country); + IsNotValid("0540", country); + IsNotValid("0654", country); + IsNotValid("0790", country); + IsNotValid("0852", country); + IsNotValid("0999", country); + } + + /// Tests patterns that should not be valid for Armenia (AM). + [Test] + public void IsNotValidCustomCases_AM_All() + { + var country = Country.AM; + + IsNotValid("5697", country); + IsNotValid("6282", country); + IsNotValid("7611", country); + IsNotValid("6767", country); + IsNotValid("8752", country); + IsNotValid("9999", country); + } + + /// Tests patterns that should not be valid for Argentina (AR). + [Test] + public void IsNotValidCustomCases_AR_All() + { + var country = Country.AR; + + IsNotValid("A0400XXX", country); + IsNotValid("S03004DD", country); + } + + /// Tests patterns that should not be valid for American Samoa (AS). + [Test] + public void IsNotValidCustomCases_AS_All() + { + var country = Country.AS; + + IsNotValid("00000", country); + IsNotValid("01449", country); + IsNotValid("12823", country); + IsNotValid("20375", country); + IsNotValid("32434", country); + IsNotValid("40082", country); + IsNotValid("56978", country); + IsNotValid("62824", country); + IsNotValid("76113", country); + IsNotValid("67671", country); + IsNotValid("87523", country); + IsNotValid("00000000", country); + IsNotValid("01494232", country); + IsNotValid("12835343", country); + IsNotValid("20357004", country); + IsNotValid("32443647", country); + IsNotValid("40027947", country); + IsNotValid("56983645", country); + IsNotValid("62846908", country); + IsNotValid("76134349", country); + IsNotValid("67618550", country); + IsNotValid("87539183", country); + } + + /// Tests patterns that should not be valid for Austria (AT). + [Test] + public void IsNotValidCustomCases_AT_All() + { + var country = Country.AT; + + IsNotValid("0000", country); + IsNotValid("0014", country); + IsNotValid("0128", country); + IsNotValid("0203", country); + IsNotValid("0324", country); + IsNotValid("0400", country); + IsNotValid("0569", country); + IsNotValid("0628", country); + IsNotValid("0761", country); + IsNotValid("0676", country); + IsNotValid("0875", country); + IsNotValid("0999", country); + } + + /// Tests patterns that should not be valid for Australia (AU). + [Test] + public void IsNotValidCustomCases_AU_All() + { + var country = Country.AU; + + IsNotValid("0000", country); + IsNotValid("0014", country); + IsNotValid("0128", country); + IsNotValid("0203", country); + IsNotValid("0324", country); + IsNotValid("0400", country); + IsNotValid("0569", country); + IsNotValid("0628", country); + IsNotValid("0761", country); + } + + /// Tests patterns that should not be valid for Åland Islands (AX). + [Test] + public void IsNotValidCustomCases_AX_All() + { + var country = Country.AX; + + IsNotValid("0000", country); + IsNotValid("0144", country); + IsNotValid("1282", country); + IsNotValid("2037", country); + IsNotValid("2000", country); + IsNotValid("2014", country); + IsNotValid("2122", country); + IsNotValid("2323", country); + IsNotValid("2408", country); + IsNotValid("2567", country); + IsNotValid("2622", country); + IsNotValid("2761", country); + IsNotValid("2677", country); + IsNotValid("2872", country); + IsNotValid("2999", country); + IsNotValid("0144", country); + IsNotValid("1282", country); + IsNotValid("2037", country); + IsNotValid("3243", country); + IsNotValid("4008", country); + IsNotValid("5697", country); + IsNotValid("6282", country); + IsNotValid("7611", country); + IsNotValid("6767", country); + IsNotValid("8752", country); + IsNotValid("9999", country); + } + + /// Tests patterns that should not be valid for Azerbaijan (AZ). + [Test] + public void IsNotValidCustomCases_AZ_All() + { + var country = Country.AZ; + + IsNotValid("DK 6990", country); + IsNotValid("GL3990", country); + IsNotValid("FO1990", country); + IsNotValid("FO990", country); + } + + /// Tests patterns that should not be valid for Bosnia And Herzegovina (BA). + [Test] + public void IsNotValidCustomCases_BA_All() + { + var country = Country.BA; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Barbados (BB). + [Test] + public void IsNotValidCustomCases_BB_All() + { + var country = Country.BB; + + IsNotValid("AA00000", country); + IsNotValid("AS01449", country); + IsNotValid("BJ12823", country); + IsNotValid("CD20375", country); + IsNotValid("DE32434", country); + IsNotValid("EO40082", country); + IsNotValid("FN56978", country); + IsNotValid("GF62824", country); + IsNotValid("HL76113", country); + IsNotValid("ID67671", country); + IsNotValid("JS87523", country); + IsNotValid("KN99999", country); + IsNotValid("LO00000", country); + IsNotValid("ME01449", country); + IsNotValid("NN12823", country); + IsNotValid("OL20375", country); + IsNotValid("PS32434", country); + IsNotValid("QD40082", country); + IsNotValid("RN56978", country); + IsNotValid("SE62824", country); + IsNotValid("TM76113", country); + IsNotValid("UF67671", country); + IsNotValid("VE87523", country); + IsNotValid("WL99999", country); + IsNotValid("XM00000", country); + IsNotValid("YE01449", country); + IsNotValid("ZL12823", country); + IsNotValid("ZZ20375", country); + } + + /// Tests patterns that should not be valid for Bangladesh (BD). + [Test] + public void IsNotValidCustomCases_BD_All() + { + var country = Country.BD; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Belgium (BE). + [Test] + public void IsNotValidCustomCases_BE_All() + { + var country = Country.BE; + + IsNotValid("0000", country); + IsNotValid("0014", country); + IsNotValid("0128", country); + IsNotValid("0203", country); + IsNotValid("0324", country); + IsNotValid("0400", country); + IsNotValid("0569", country); + IsNotValid("0628", country); + IsNotValid("0761", country); + IsNotValid("0676", country); + IsNotValid("0875", country); + IsNotValid("0999", country); + } + + /// Tests patterns that should not be valid for Bulgaria (BG). + [Test] + public void IsNotValidCustomCases_BG_All() + { + var country = Country.BG; + + IsNotValid("0000", country); + IsNotValid("0014", country); + IsNotValid("0128", country); + IsNotValid("0203", country); + IsNotValid("0324", country); + IsNotValid("0400", country); + IsNotValid("0569", country); + IsNotValid("0628", country); + IsNotValid("0761", country); + IsNotValid("0676", country); + IsNotValid("0875", country); + IsNotValid("0999", country); + } + + /// Tests patterns that should not be valid for Bahrain (BH). + [Test] + public void IsNotValidCustomCases_BH_All() + { + var country = Country.BH; + + IsNotValid("000", country); + IsNotValid("014", country); + IsNotValid("1328", country); + IsNotValid("2037", country); + IsNotValid("3243", country); + IsNotValid("4008", country); + IsNotValid("5697", country); + IsNotValid("6282", country); + IsNotValid("7611", country); + IsNotValid("6767", country); + IsNotValid("8752", country); + IsNotValid("9999", country); + } + + /// Tests patterns that should not be valid for Saint Barthélemy (BL). + [Test] + public void IsNotValidCustomCases_BL_All() + { + var country = Country.BL; + + IsNotValid("00000", country); + IsNotValid("01235", country); + IsNotValid("12346", country); + IsNotValid("20004", country); + IsNotValid("32648", country); + IsNotValid("40945", country); + IsNotValid("56640", country); + IsNotValid("62908", country); + IsNotValid("76345", country); + IsNotValid("67552", country); + IsNotValid("87182", country); + IsNotValid("99999", country); + } + + /// Tests patterns that should not be valid for Bermuda (BM). + [Test] + public void IsNotValidCustomCases_BM_All() + { + var country = Country.BM; + + IsNotValid("A0", country); + IsNotValid("A1", country); + IsNotValid("B2", country); + IsNotValid("C0", country); + IsNotValid("D2", country); + IsNotValid("E0", country); + IsNotValid("6F", country); + IsNotValid("2G", country); + IsNotValid("6H", country); + IsNotValid("7I", country); + IsNotValid("7J", country); + IsNotValid("9K", country); + IsNotValid("0L", country); + IsNotValid("013S", country); + IsNotValid("12RF", country); + IsNotValid("2034", country); + IsNotValid("2A34", country); + } + + /// Tests patterns that should not be valid for Brunei Darussalam (BN). + [Test] + public void IsNotValidCustomCases_BN_All() + { + var country = Country.BN; + + IsNotValid("0000DF", country); + IsNotValid("2325DS", country); + IsNotValid("3436RF", country); + IsNotValid("0044WK", country); + IsNotValid("6478SD", country); + IsNotValid("9475PJ", country); + IsNotValid("6450KF", country); + IsNotValid("9088LS", country); + IsNotValid("3495JD", country); + IsNotValid("5502MO", country); + IsNotValid("1832DF", country); + IsNotValid("K999JS", country); + IsNotValid("L000DF", country); + IsNotValid("M325DS", country); + IsNotValid("N436RF", country); + IsNotValid("O044WK", country); + IsNotValid("P478SD", country); + IsNotValid("Q475PJ", country); + IsNotValid("RN578F", country); + IsNotValid("SE624S", country); + IsNotValid("TM713D", country); + IsNotValid("UF671O", country); + IsNotValid("VE823F", country); + IsNotValid("WL999S", country); + IsNotValid("XMD000", country); + IsNotValid("YED014", country); + IsNotValid("ZLR128", country); + IsNotValid("ZZW203", country); + } + + /// Tests patterns that should not be valid for Bolivia (BO). + [Test] + public void IsNotValidCustomCases_BO_All() + { + var country = Country.BO; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Brazil (BR). + [Test] + public void IsNotValidCustomCases_BR_All() + { + var country = Country.BR; + + IsNotValid("00000000", country); + IsNotValid("00014494", country); + IsNotValid("00128235", country); + IsNotValid("00203757", country); + IsNotValid("00324343", country); + IsNotValid("00400827", country); + IsNotValid("00569783", country); + IsNotValid("00628246", country); + IsNotValid("00761134", country); + IsNotValid("00676718", country); + IsNotValid("00875239", country); + IsNotValid("00999999", country); + } + + /// Tests patterns that should not be valid for Bhutan (BT). + [Test] + public void IsNotValidCustomCases_BT_All() + { + var country = Country.BT; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Belarus (BY). + [Test] + public void IsNotValidCustomCases_BY_All() + { + var country = Country.BY; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Canada (CA). + [Test] + public void IsNotValidCustomCases_CA_All() + { + var country = Country.CA; + + // No D, F, I, O, Q, and U (and W and Z to start with). + + IsNotValid("H0D0H0", country); + IsNotValid("A0F0D0", country); + IsNotValid("A0I1D4", country); + IsNotValid("B1O2R8", country); + IsNotValid("C2Q0W3", country); + IsNotValid("D3U2S4", country); + IsNotValid("E4O0D0", country); + IsNotValid("F5N6F9", country); + IsNotValid("G6F2I8", country); + IsNotValid("D7L6O1", country); + IsNotValid("F6D7Q6", country); + IsNotValid("I8S7U5", country); + IsNotValid("O9N9J9", country); + IsNotValid("Q0O0D0", country); + IsNotValid("U0E1D4", country); + IsNotValid("W1N2R8", country); + IsNotValid("Z2L0W3", country); + } + + /// Tests patterns that should not be valid for Cocos (CC). + [Test] + public void IsNotValidCustomCases_CC_All() + { + var country = Country.CC; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Switzerland (CH). + [Test] + public void IsNotValidCustomCases_CH_All() + { + var country = Country.CH; + + IsNotValid("0000", country); + IsNotValid("0014", country); + IsNotValid("0128", country); + IsNotValid("0203", country); + IsNotValid("0324", country); + IsNotValid("0400", country); + IsNotValid("0569", country); + IsNotValid("0628", country); + IsNotValid("0761", country); + IsNotValid("0676", country); + IsNotValid("0875", country); + IsNotValid("0999", country); + } + + /// Tests patterns that should not be valid for Chile (CL). + [Test] + public void IsNotValidCustomCases_CL_All() + { + var country = Country.CL; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for China (CN). + [Test] + public void IsNotValidCustomCases_CN_All() + { + var country = Country.CN; + + IsNotValid("0000", country); + IsNotValid("0004", country); + IsNotValid("0018", country); + IsNotValid("0023", country); + IsNotValid("0034", country); + IsNotValid("0040", country); + IsNotValid("0059", country); + IsNotValid("0068", country); + IsNotValid("0071", country); + IsNotValid("0066", country); + IsNotValid("0085", country); + IsNotValid("0099", country); + } + + /// Tests patterns that should not be valid for Colombia (CO). + [Test] + public void IsNotValidCustomCases_CO_All() + { + var country = Country.CO; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Costa Rica (CR). + [Test] + public void IsNotValidCustomCases_CR_All() + { + var country = Country.CR; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Cuba (CU). + [Test] + public void IsNotValidCustomCases_CU_All() + { + var country = Country.CU; + + IsNotValid("CP000", country); + IsNotValid("CP035", country); + IsNotValid("CP146", country); + IsNotValid("CP204", country); + IsNotValid("CP348", country); + } + + /// Tests patterns that should not be valid for Cape Verde (CV). + [Test] + public void IsNotValidCustomCases_CV_All() + { + var country = Country.CV; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Christmas Island (CX). + [Test] + public void IsNotValidCustomCases_CX_All() + { + var country = Country.CX; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Cyprus (CY). + [Test] + public void IsNotValidCustomCases_CY_All() + { + var country = Country.CY; + + IsNotValid("0000", country); + IsNotValid("0014", country); + IsNotValid("0128", country); + IsNotValid("0203", country); + IsNotValid("0324", country); + IsNotValid("0400", country); + IsNotValid("0569", country); + IsNotValid("0628", country); + IsNotValid("0761", country); + IsNotValid("0676", country); + IsNotValid("0875", country); + IsNotValid("0999", country); + } + + /// Tests patterns that should not be valid for Czech Republic (CZ). + [Test] + public void IsNotValidCustomCases_CZ_All() + { + var country = Country.CZ; + + IsNotValid("0000", country); + IsNotValid("0014", country); + IsNotValid("0128", country); + IsNotValid("0203", country); + IsNotValid("0324", country); + IsNotValid("0400", country); + IsNotValid("0569", country); + IsNotValid("0628", country); + IsNotValid("0761", country); + IsNotValid("0676", country); + IsNotValid("0875", country); + IsNotValid("0999", country); + + IsNotValid("8000", country); + IsNotValid("8004", country); + IsNotValid("8018", country); + IsNotValid("8023", country); + IsNotValid("8034", country); + IsNotValid("8040", country); + IsNotValid("9059", country); + IsNotValid("9068", country); + IsNotValid("9071", country); + IsNotValid("9066", country); + IsNotValid("9085", country); + IsNotValid("9099", country); + } + + /// Tests patterns that should not be valid for Germany (DE). + [Test] + public void IsNotValidCustomCases_DE_All() + { + var country = Country.DE; + + IsNotValid("00007", country); + IsNotValid("00043", country); + IsNotValid("00188", country); + IsNotValid("00237", country); + IsNotValid("00342", country); + IsNotValid("00401", country); + IsNotValid("00597", country); + IsNotValid("00682", country); + IsNotValid("00719", country); + IsNotValid("00665", country); + IsNotValid("00853", country); + IsNotValid("00999", country); + } + + /// Tests patterns that should not be valid for Denmark (DK). + [Test] + public void IsNotValidCustomCases_DK_All() + { + var country = Country.DK; + + IsNotValid("0000", country); + IsNotValid("0014", country); + IsNotValid("0128", country); + IsNotValid("0203", country); + IsNotValid("0324", country); + IsNotValid("0400", country); + IsNotValid("0569", country); + IsNotValid("0628", country); + IsNotValid("0761", country); + IsNotValid("0676", country); + IsNotValid("0875", country); + IsNotValid("0999", country); + + IsNotValid("DK0000", country); + IsNotValid("DK0014", country); + IsNotValid("DK0128", country); + IsNotValid("DK0203", country); + IsNotValid("DK0324", country); + IsNotValid("DK0400", country); + IsNotValid("DK0569", country); + IsNotValid("DK0628", country); + IsNotValid("DK0761", country); + IsNotValid("DK0676", country); + IsNotValid("DK0875", country); + IsNotValid("DK0999", country); + + IsNotValid("AA0000", country); + IsNotValid("AS0144", country); + IsNotValid("BJ1282", country); + IsNotValid("CD2037", country); + IsNotValid("DE3243", country); + IsNotValid("EO4008", country); + IsNotValid("FN5697", country); + IsNotValid("GF6282", country); + IsNotValid("HL7611", country); + IsNotValid("ID6767", country); + IsNotValid("JS8752", country); + IsNotValid("KN9999", country); + IsNotValid("LO0000", country); + IsNotValid("ME0144", country); + IsNotValid("NN1282", country); + } + + /// Tests patterns that should not be valid for Algeria (DZ). + [Test] + public void IsNotValidCustomCases_DZ_All() + { + var country = Country.DZ; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Ecuador (EC). + [Test] + public void IsNotValidCustomCases_EC_All() + { + var country = Country.EC; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Estonia (EE). + [Test] + public void IsNotValidCustomCases_EE_All() + { + var country = Country.EE; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Egypt (EG). + [Test] + public void IsNotValidCustomCases_EG_All() + { + var country = Country.EG; + + IsNotValid("00000", country); + IsNotValid("01235", country); + } + + /// Tests patterns that should not be valid for Spain (ES). + [Test] + public void IsNotValidCustomCases_ES_All() + { + var country = Country.ES; + + IsNotValid("00000", country); + IsNotValid("53434", country); + IsNotValid("54082", country); + IsNotValid("55978", country); + IsNotValid("56824", country); + IsNotValid("57113", country); + IsNotValid("56671", country); + IsNotValid("58523", country); + IsNotValid("59999", country); + IsNotValid("62824", country); + IsNotValid("76113", country); + IsNotValid("67671", country); + IsNotValid("87523", country); + IsNotValid("99999", country); + } + + /// Tests patterns that should not be valid for Ethiopia (ET). + [Test] + public void IsNotValidCustomCases_ET_All() + { + var country = Country.ET; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Finland (FI). + [Test] + public void IsNotValidCustomCases_FI_All() + { + var country = Country.FI; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Falkland Islands (FK). + [Test] + public void IsNotValidCustomCases_FK_All() + { + var country = Country.FK; + + IsNotValid("FIAA1ZZ", country); + IsNotValid("FIAA9ZZ", country); + IsNotValid("DN551PT", country); + IsNotValid("DN551PT", country); + IsNotValid("EC1A1BB", country); + IsNotValid("EC1A1BB", country); + + } + + /// Tests patterns that should not be valid for Micronesia (FM). + [Test] + public void IsNotValidCustomCases_FM_All() + { + var country = Country.FM; + + IsNotValid("00000", country); + IsNotValid("01234", country); + IsNotValid("01449", country); + IsNotValid("12823", country); + IsNotValid("20375", country); + IsNotValid("32434", country); + IsNotValid("40082", country); + IsNotValid("56978", country); + IsNotValid("62824", country); + IsNotValid("76113", country); + IsNotValid("67671", country); + IsNotValid("87523", country); + IsNotValid("99999", country); + + IsNotValid("000000000", country); + IsNotValid("012345678", country); + IsNotValid("014494232", country); + IsNotValid("128235343", country); + IsNotValid("203757004", country); + IsNotValid("324343647", country); + IsNotValid("400827947", country); + IsNotValid("569783645", country); + IsNotValid("628246908", country); + IsNotValid("761134349", country); + IsNotValid("676718550", country); + IsNotValid("875239183", country); + IsNotValid("999999999", country); + } + + /// Tests patterns that should not be valid for Faroe Islands (FO). + [Test] + public void IsNotValidCustomCases_FO_All() + { + var country = Country.FO; + + IsNotValid("000", country); + IsNotValid("004", country); + IsNotValid("018", country); + IsNotValid("023", country); + IsNotValid("034", country); + IsNotValid("040", country); + IsNotValid("059", country); + IsNotValid("068", country); + IsNotValid("071", country); + IsNotValid("066", country); + IsNotValid("085", country); + IsNotValid("099", country); + + IsNotValid("FO000", country); + IsNotValid("FO004", country); + IsNotValid("FO018", country); + IsNotValid("FO023", country); + IsNotValid("FO034", country); + IsNotValid("FO040", country); + IsNotValid("FO059", country); + IsNotValid("FO068", country); + IsNotValid("FO071", country); + IsNotValid("FO066", country); + IsNotValid("FO085", country); + IsNotValid("FO099", country); + + IsNotValid("AA000", country); + IsNotValid("AS044", country); + IsNotValid("BJ182", country); + IsNotValid("CD237", country); + IsNotValid("DE343", country); + IsNotValid("EO408", country); + IsNotValid("FN597", country); + IsNotValid("GF682", country); + IsNotValid("HL711", country); + IsNotValid("ID667", country); + IsNotValid("JS852", country); + IsNotValid("KN999", country); + IsNotValid("LO000", country); + IsNotValid("ME044", country); + IsNotValid("NN182", country); + } + + /// Tests patterns that should not be valid for France (FR). + [Test] + public void IsNotValidCustomCases_FR_All() + { + var country = Country.FR; + + IsNotValid("00007", country); + IsNotValid("00043", country); + IsNotValid("00188", country); + IsNotValid("00237", country); + IsNotValid("00342", country); + IsNotValid("00401", country); + IsNotValid("00597", country); + IsNotValid("00682", country); + IsNotValid("00719", country); + IsNotValid("00665", country); + IsNotValid("00853", country); + IsNotValid("00999", country); + } + + /// Tests patterns that should not be valid for Gabon (GA). + [Test] + public void IsNotValidCustomCases_GA_All() + { + var country = Country.GA; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for United Kingdom (GB). + [Test] + public void IsNotValidCustomCases_GB_All() + { + var country = Country.GB; + + IsNotValid("311AA", country); + IsNotValid("M113A", country); + IsNotValid("M11A8", country); + IsNotValid("M1BAA", country); + + IsNotValid("1338TH", country); + IsNotValid("B338B9", country); + + IsNotValid("CRABXH", country); + IsNotValid("CR26X9", country); + + IsNotValid("DN55PPT", country); + IsNotValid("D1551PT", country); + + IsNotValid("WWA1HQ", country); + IsNotValid("W1A123", country); + + IsNotValid("EC1A112", country); + IsNotValid("EC1816B", country); + } + + /// Tests patterns that should not be valid for Georgia (GE). + [Test] + public void IsNotValidCustomCases_GE_All() + { + var country = Country.GE; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for French Guiana (GF). + [Test] + public void IsNotValidCustomCases_GF_All() + { + var country = Country.GF; + + IsNotValid("00000", country); + IsNotValid("01235", country); + IsNotValid("12346", country); + IsNotValid("20004", country); + IsNotValid("32648", country); + IsNotValid("40945", country); + IsNotValid("56640", country); + IsNotValid("62908", country); + IsNotValid("76345", country); + IsNotValid("67552", country); + IsNotValid("87182", country); + IsNotValid("99999", country); + + } + + /// Tests patterns that should not be valid for Guernsey (GG). + [Test] + public void IsNotValidCustomCases_GG_All() + { + var country = Country.GG; + + IsNotValid("336R", country); + IsNotValid("044W", country); + IsNotValid("678S", country); + IsNotValid("975P", country); + IsNotValid("650K", country); + IsNotValid("988L", country); + IsNotValid("395J", country); + + IsNotValid("5502M", country); + IsNotValid("1832D", country); + IsNotValid("9999J", country); + IsNotValid("0000D", country); + IsNotValid("2325D", country); + IsNotValid("3436R", country); + IsNotValid("0044W", country); + + IsNotValid("GG336R", country); + IsNotValid("GG044W", country); + IsNotValid("GG678S", country); + IsNotValid("GG975P", country); + IsNotValid("GG650K", country); + IsNotValid("GG988L", country); + IsNotValid("GG395J", country); + + IsNotValid("GG5502M", country); + IsNotValid("GG1832D", country); + IsNotValid("GG9999J", country); + IsNotValid("GG0000D", country); + IsNotValid("GG2325D", country); + IsNotValid("GG3436R", country); + IsNotValid("GG0044W", country); + + IsNotValid("GF88LS", country); + IsNotValid("HL95JD", country); + IsNotValid("ID02MO", country); + IsNotValid("JS32DF", country); + IsNotValid("KN99JS", country); + IsNotValid("LO00DF", country); + IsNotValid("ME25DS", country); + + IsNotValid("AA000DF", country); + IsNotValid("AS325DS", country); + IsNotValid("BJ436RF", country); + IsNotValid("CD044WK", country); + IsNotValid("DE478SD", country); + IsNotValid("EO475PJ", country); + IsNotValid("FN450KF", country); + } + + /// Tests patterns that should not be valid for Gibraltar (GI). + [Test] + public void IsNotValidCustomCases_GI_All() + { + var country = Country.GI; + + IsNotValid("DN123AA", country); + IsNotValid("GX123BB", country); + } + + /// Tests patterns that should not be valid for Greenland (GL). + [Test] + public void IsNotValidCustomCases_GL_All() + { + var country = Country.GL; + + IsNotValid("5502", country); + IsNotValid("1832", country); + IsNotValid("9999", country); + IsNotValid("0000", country); + IsNotValid("2325", country); + IsNotValid("3136", country); + IsNotValid("3236", country); + IsNotValid("3436", country); + IsNotValid("3436", country); + IsNotValid("3567", country); + IsNotValid("0044", country); + + IsNotValid("GL3365", country); + IsNotValid("GL0448", country); + IsNotValid("GL6789", country); + IsNotValid("GL9750", country); + IsNotValid("GL6503", country); + IsNotValid("GL9881", country); + IsNotValid("GL3852", country); + + IsNotValid("AA3900", country); + IsNotValid("AS3935", country); + IsNotValid("BJ3946", country); + IsNotValid("CD3904", country); + IsNotValid("DE3948", country); + IsNotValid("EO3945", country); + IsNotValid("FN3940", country); + } + + /// Tests patterns that should not be valid for Guadeloupe (GP). + [Test] + public void IsNotValidCustomCases_GP_All() + { + var country = Country.GP; + + IsNotValid("00000", country); + IsNotValid("01235", country); + IsNotValid("12346", country); + IsNotValid("20004", country); + IsNotValid("32648", country); + IsNotValid("40945", country); + IsNotValid("56640", country); + IsNotValid("62908", country); + IsNotValid("76345", country); + IsNotValid("67552", country); + IsNotValid("87182", country); + IsNotValid("99999", country); + } + + /// Tests patterns that should not be valid for Greece (GR). + [Test] + public void IsNotValidCustomCases_GR_All() + { + var country = Country.GR; + + IsNotValid("00072", country); + IsNotValid("00433", country); + IsNotValid("01885", country); + IsNotValid("02374", country); + IsNotValid("03421", country); + IsNotValid("04014", country); + IsNotValid("05957", country); + IsNotValid("06862", country); + IsNotValid("07159", country); + IsNotValid("06685", country); + IsNotValid("08593", country); + IsNotValid("09999", country); + } + + /// Tests patterns that should not be valid for South Georgia And The South Sandwich Islands (GS). + [Test] + public void IsNotValidCustomCases_GS_All() + { + var country = Country.GS; + + IsNotValid("SIQQ1AZ", country); + IsNotValid("SIQQ9ZZ", country); + IsNotValid("SIBB1ZZ", country); + IsNotValid("DN551PT", country); + IsNotValid("DN551PT", country); + IsNotValid("EC1A1BB", country); + IsNotValid("EC1A1BB", country); + } + + /// Tests patterns that should not be valid for Guatemala (GT). + [Test] + public void IsNotValidCustomCases_GT_All() + { + var country = Country.GT; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Guam (GU). + [Test] + public void IsNotValidCustomCases_GU_All() + { + var country = Country.GU; + + IsNotValid("00000", country); + IsNotValid("01235", country); + IsNotValid("12346", country); + IsNotValid("20004", country); + IsNotValid("32648", country); + IsNotValid("40945", country); + IsNotValid("56640", country); + IsNotValid("62908", country); + IsNotValid("76345", country); + IsNotValid("67552", country); + IsNotValid("87182", country); + IsNotValid("96908", country); + IsNotValid("96938", country); + IsNotValid("99999", country); + + IsNotValid("000000000", country); + IsNotValid("012301235", country); + IsNotValid("123412346", country); + IsNotValid("200020004", country); + IsNotValid("326432648", country); + IsNotValid("409440945", country); + IsNotValid("566456640", country); + IsNotValid("629062908", country); + IsNotValid("763476345", country); + IsNotValid("675567552", country); + IsNotValid("871887182", country); + IsNotValid("969087182", country); + IsNotValid("969387182", country); + IsNotValid("999999999", country); + } + + /// Tests patterns that should not be valid for Guinea-Bissau (GW). + [Test] + public void IsNotValidCustomCases_GW_All() + { + var country = Country.GW; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Heard Island And Mcdonald Islands (HM). + [Test] + public void IsNotValidCustomCases_HM_All() + { + var country = Country.HM; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Honduras (HN). + [Test] + public void IsNotValidCustomCases_HN_All() + { + var country = Country.HN; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Croatia (HR). + [Test] + public void IsNotValidCustomCases_HR_All() + { + var country = Country.HR; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Haiti (HT). + [Test] + public void IsNotValidCustomCases_HT_All() + { + var country = Country.HT; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Hungary (HU). + [Test] + public void IsNotValidCustomCases_HU_All() + { + var country = Country.HU; + + IsNotValid("0007", country); + IsNotValid("0043", country); + IsNotValid("0188", country); + IsNotValid("0237", country); + IsNotValid("0342", country); + IsNotValid("0401", country); + IsNotValid("0595", country); + IsNotValid("0686", country); + IsNotValid("0715", country); + IsNotValid("0668", country); + IsNotValid("0859", country); + IsNotValid("0999", country); + } + + /// Tests patterns that should not be valid for Indonesia (ID). + [Test] + public void IsNotValidCustomCases_ID_All() + { + var country = Country.ID; + + IsNotValid("00072", country); + IsNotValid("00433", country); + IsNotValid("01885", country); + IsNotValid("02374", country); + IsNotValid("03421", country); + IsNotValid("04014", country); + IsNotValid("05957", country); + IsNotValid("06862", country); + IsNotValid("07159", country); + IsNotValid("06685", country); + IsNotValid("08593", country); + IsNotValid("09999", country); + } + + /// Tests patterns that should not be valid for Israel (IL). + [Test] + public void IsNotValidCustomCases_IL_All() + { + var country = Country.IL; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Isle Of Man (IM). + [Test] + public void IsNotValidCustomCases_IM_All() + { + var country = Country.IM; + + IsNotValid("IMAA00DF", country); + IsNotValid("IMAS04DS", country); + IsNotValid("IMBJ18RF", country); + IsNotValid("IMCD23WK", country); + IsNotValid("IMDE34SD", country); + IsNotValid("IMEO40PJ", country); + IsNotValid("IMFN59KF", country); + IsNotValid("IMGF68LS", country); + IsNotValid("IMHL71JD", country); + IsNotValid("IMID66MO", country); + IsNotValid("IMJS85DF", country); + IsNotValid("IMKN99JS", country); + IsNotValid("IMLO00DF", country); + + IsNotValid("AA000DF", country); + IsNotValid("AS014DS", country); + IsNotValid("BJ128RF", country); + IsNotValid("CD203WK", country); + IsNotValid("DE324SD", country); + IsNotValid("EO400PJ", country); + IsNotValid("FN569KF", country); + IsNotValid("GF628LS", country); + IsNotValid("HL761JD", country); + IsNotValid("ID676MO", country); + IsNotValid("JS875DF", country); + IsNotValid("KN999JS", country); + IsNotValid("LO000DF", country); + } + + /// Tests patterns that should not be valid for India (IN). + [Test] + public void IsNotValidCustomCases_IN_All() + { + var country = Country.IN; + + IsNotValid("00000", country); + IsNotValid("00149", country); + IsNotValid("01283", country); + IsNotValid("02035", country); + IsNotValid("03244", country); + IsNotValid("04002", country); + IsNotValid("05698", country); + IsNotValid("06284", country); + IsNotValid("07613", country); + IsNotValid("06761", country); + IsNotValid("08753", country); + IsNotValid("09999", country); + } + + /// Tests patterns that should not be valid for British Indian Ocean Territory (IO). + [Test] + public void IsNotValidCustomCases_IO_All() + { + var country = Country.IO; + + IsNotValid("AADF0DF", country); + IsNotValid("ASDS0DS", country); + IsNotValid("BJRF1RF", country); + IsNotValid("CDWK2WK", country); + IsNotValid("DESD3SD", country); + IsNotValid("EOPJ4PJ", country); + IsNotValid("FNKF5KF", country); + IsNotValid("GFLS6LS", country); + IsNotValid("HLJD7JD", country); + IsNotValid("IDMO6MO", country); + IsNotValid("JSDF8DF", country); + IsNotValid("KNJS9JS", country); + } + + /// Tests patterns that should not be valid for Iraq (IQ). + [Test] + public void IsNotValidCustomCases_IQ_All() + { + var country = Country.IQ; + + IsNotValid("00000", country); + IsNotValid("20004", country); + IsNotValid("76345", country); + IsNotValid("87182", country); + IsNotValid("99999", country); + } + + /// Tests patterns that should not be valid for Iran (IR). + [Test] + public void IsNotValidCustomCases_IR_All() + { + var country = Country.IR; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Iceland (IS). + [Test] + public void IsNotValidCustomCases_IS_All() + { + var country = Country.IS; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Italy (IT). + [Test] + public void IsNotValidCustomCases_IT_All() + { + var country = Country.IT; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Jersey (JE). + [Test] + public void IsNotValidCustomCases_JE_All() + { + var country = Country.JE; + + IsNotValid("0", country); + + IsNotValid("A00S", country); + IsNotValid("G25S", country); + IsNotValid("D36F", country); + IsNotValid("D44S", country); + IsNotValid("R78F", country); + IsNotValid("W75K", country); + IsNotValid("5D0S", country); + IsNotValid("8J8P", country); + IsNotValid("9F5K", country); + IsNotValid("0LS2", country); + IsNotValid("3JD2", country); + IsNotValid("9MO9", country); + IsNotValid("0AS0", country); + IsNotValid("G042S", country); + IsNotValid("D153F", country); + IsNotValid("D274S", country); + IsNotValid("3R37F", country); + IsNotValid("4W77K", country); + IsNotValid("5S35D", country); + IsNotValid("66PJ8", country); + IsNotValid("74KF9", country); + IsNotValid("6S80L", country); + IsNotValid("8D93J", country); + IsNotValid("9O99M", country); + } + + /// Tests patterns that should not be valid for Jordan (JO). + [Test] + public void IsNotValidCustomCases_JO_All() + { + var country = Country.JO; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Japan (JP). + [Test] + public void IsNotValidCustomCases_JP_All() + { + var country = Country.JP; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Kyrgyzstan (KG). + [Test] + public void IsNotValidCustomCases_KG_All() + { + var country = Country.KG; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Cambodia (KH). + [Test] + public void IsNotValidCustomCases_KH_All() + { + var country = Country.KH; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Korea (KR). + [Test] + public void IsNotValidCustomCases_KR_All() + { + var country = Country.KR; + + IsNotValid("000000", country); + IsNotValid("023456", country); + IsNotValid("012823", country); + IsNotValid("020375", country); + IsNotValid("032434", country); + IsNotValid("040082", country); + IsNotValid("056978", country); + IsNotValid("862824", country); + IsNotValid("861134", country); + IsNotValid("876718", country); + IsNotValid("975239", country); + IsNotValid("999999", country); + } + + /// Tests patterns that should not be valid for Cayman Islands (KY). + [Test] + public void IsNotValidCustomCases_KY_All() + { + var country = Country.KY; + + IsNotValid("AA00000", country); + IsNotValid("AS01449", country); + IsNotValid("BJ12823", country); + IsNotValid("CD20375", country); + IsNotValid("DE32434", country); + IsNotValid("EO40082", country); + IsNotValid("FN56978", country); + IsNotValid("GF62824", country); + IsNotValid("HL76113", country); + IsNotValid("ID67671", country); + IsNotValid("JS87523", country); + IsNotValid("KN99999", country); + IsNotValid("LO00000", country); + IsNotValid("ME01449", country); + IsNotValid("NN12823", country); + IsNotValid("OL20375", country); + IsNotValid("PS32434", country); + IsNotValid("QD40082", country); + IsNotValid("RN56978", country); + IsNotValid("SE62824", country); + IsNotValid("TM76113", country); + IsNotValid("UF67671", country); + IsNotValid("VE87523", country); + IsNotValid("WL99999", country); + IsNotValid("XM00000", country); + IsNotValid("YE01449", country); + IsNotValid("ZL12823", country); + IsNotValid("ZZ20375", country); + } + + /// Tests patterns that should not be valid for Kazakhstan (KZ). + [Test] + public void IsNotValidCustomCases_KZ_All() + { + var country = Country.KZ; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Lao People'S Democratic Republic (LA). + [Test] + public void IsNotValidCustomCases_LA_All() + { + var country = Country.LA; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Lebanon (LB). + [Test] + public void IsNotValidCustomCases_LB_All() + { + var country = Country.LB; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Liechtenstein (LI). + [Test] + public void IsNotValidCustomCases_LI_All() + { + var country = Country.LI; + + IsNotValid("0000", country); + IsNotValid("0144", country); + IsNotValid("1282", country); + IsNotValid("2037", country); + IsNotValid("3243", country); + IsNotValid("4008", country); + IsNotValid("5697", country); + IsNotValid("6282", country); + IsNotValid("7611", country); + IsNotValid("6767", country); + IsNotValid("8752", country); + IsNotValid("9999", country); + + IsNotValid("9300", country); + IsNotValid("9499", country); + IsNotValid("9593", country); + IsNotValid("9679", country); + IsNotValid("9480", country); + IsNotValid("9481", country); + IsNotValid("9482", country); + IsNotValid("9483", country); + IsNotValid("9484", country); + IsNotValid("9499", country); + } + + /// Tests patterns that should not be valid for Sri Lanka (LK). + [Test] + public void IsNotValidCustomCases_LK_All() + { + var country = Country.LK; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Liberia (LR). + [Test] + public void IsNotValidCustomCases_LR_All() + { + var country = Country.LR; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Lesotho (LS). + [Test] + public void IsNotValidCustomCases_LS_All() + { + var country = Country.LS; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Lithuania (LT). + [Test] + public void IsNotValidCustomCases_LT_All() + { + var country = Country.LT; + + IsNotValid("AA00000", country); + IsNotValid("AS01449", country); + IsNotValid("BJ12823", country); + IsNotValid("CD20375", country); + IsNotValid("DE32434", country); + IsNotValid("EO40082", country); + IsNotValid("FN56978", country); + IsNotValid("GF62824", country); + IsNotValid("HL76113", country); + IsNotValid("ID67671", country); + IsNotValid("JS87523", country); + IsNotValid("KN99999", country); + IsNotValid("LO00000", country); + IsNotValid("ME01449", country); + IsNotValid("NN12823", country); + IsNotValid("OL20375", country); + IsNotValid("PS32434", country); + IsNotValid("QD40082", country); + IsNotValid("RN56978", country); + IsNotValid("SE62824", country); + IsNotValid("TM76113", country); + IsNotValid("UF67671", country); + IsNotValid("VE87523", country); + IsNotValid("WL99999", country); + IsNotValid("XM00000", country); + IsNotValid("YE01449", country); + IsNotValid("ZL12823", country); + IsNotValid("ZZ20375", country); + } + + /// Tests patterns that should not be valid for Luxembourg (LU). + [Test] + public void IsNotValidCustomCases_LU_All() + { + var country = Country.LU; + + IsNotValid("AA0000", country); + IsNotValid("AS0144", country); + IsNotValid("BJ1282", country); + IsNotValid("CD2037", country); + IsNotValid("DE3243", country); + IsNotValid("EO4008", country); + IsNotValid("FN5697", country); + IsNotValid("GF6282", country); + IsNotValid("HL7611", country); + IsNotValid("ID6767", country); + IsNotValid("JS8752", country); + IsNotValid("KN9999", country); + IsNotValid("LO0000", country); + IsNotValid("ME0144", country); + IsNotValid("NN1282", country); + IsNotValid("OL2037", country); + IsNotValid("PS3243", country); + } + + /// Tests patterns that should not be valid for Latvia (LV). + [Test] + public void IsNotValidCustomCases_LV_All() + { + var country = Country.KY; + + IsNotValid("AA0000", country); + IsNotValid("AS0449", country); + IsNotValid("BJ1823", country); + IsNotValid("CD2375", country); + IsNotValid("DE3434", country); + IsNotValid("EO4082", country); + IsNotValid("FN5978", country); + IsNotValid("GF6824", country); + IsNotValid("HL7113", country); + IsNotValid("ID6671", country); + IsNotValid("JS8523", country); + IsNotValid("KN9999", country); + IsNotValid("LO0000", country); + IsNotValid("ME0449", country); + IsNotValid("NN1823", country); + IsNotValid("OL2375", country); + IsNotValid("PS3434", country); + IsNotValid("QD4082", country); + IsNotValid("RN5978", country); + IsNotValid("SE6824", country); + IsNotValid("TM7113", country); + IsNotValid("UF6671", country); + IsNotValid("VE8523", country); + IsNotValid("WL9999", country); + IsNotValid("XM0000", country); + IsNotValid("YE0449", country); + IsNotValid("ZL1823", country); + IsNotValid("ZZ2375", country); + } + + /// Tests patterns that should not be valid for Libya (LY). + [Test] + public void IsNotValidCustomCases_LY_All() + { + var country = Country.LY; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Morocco (MA). + [Test] + public void IsNotValidCustomCases_MA_All() + { + var country = Country.MA; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Monaco (MC). + [Test] + public void IsNotValidCustomCases_MC_All() + { + var country = Country.MC; + + IsNotValid("00000", country); + IsNotValid("04249", country); + IsNotValid("18323", country); + IsNotValid("23475", country); + IsNotValid("34734", country); + IsNotValid("40782", country); + IsNotValid("59578", country); + IsNotValid("68824", country); + IsNotValid("71913", country); + IsNotValid("66071", country); + IsNotValid("98123", country); + IsNotValid("98299", country); + IsNotValid("98344", country); + IsNotValid("98402", country); + IsNotValid("98598", country); + IsNotValid("98684", country); + IsNotValid("98713", country); + IsNotValid("98661", country); + IsNotValid("98983", country); + IsNotValid("98989", country); + IsNotValid("00000", country); + + IsNotValid("MC00000", country); + IsNotValid("MC04249", country); + IsNotValid("MC18323", country); + IsNotValid("MC23475", country); + IsNotValid("MC34734", country); + IsNotValid("MC40782", country); + IsNotValid("MC59578", country); + IsNotValid("MC68824", country); + IsNotValid("MC71913", country); + IsNotValid("MC66071", country); + IsNotValid("MC85323", country); + IsNotValid("MC99999", country); + IsNotValid("MC00000", country); + + IsNotValid("AA98000", country); + IsNotValid("AS98049", country); + IsNotValid("BJ98023", country); + IsNotValid("CD98075", country); + IsNotValid("DE98034", country); + IsNotValid("EO98082", country); + IsNotValid("FN98078", country); + IsNotValid("GF98024", country); + IsNotValid("HL98013", country); + IsNotValid("ID98071", country); + IsNotValid("JS98023", country); + IsNotValid("KN98099", country); + IsNotValid("LO98000", country); + IsNotValid("ME98049", country); + IsNotValid("NN98023", country); + IsNotValid("OL98075", country); + IsNotValid("PS98034", country); + IsNotValid("QD98082", country); + IsNotValid("RN98078", country); + IsNotValid("SE98024", country); + IsNotValid("TM98013", country); + IsNotValid("UF98071", country); + IsNotValid("VE98023", country); + IsNotValid("WL98099", country); + IsNotValid("XM98000", country); + IsNotValid("YE98049", country); + IsNotValid("ZL98023", country); + IsNotValid("ZZ98075", country); + } + + /// Tests patterns that should not be valid for Moldova (MD). + [Test] + public void IsNotValidCustomCases_MD_All() + { + var country = Country.MD; + + IsNotValid("AA0000", country); + IsNotValid("AS0144", country); + IsNotValid("BJ1282", country); + IsNotValid("CD2037", country); + IsNotValid("DE3243", country); + IsNotValid("EO4008", country); + IsNotValid("FN5697", country); + IsNotValid("GF6282", country); + IsNotValid("HL7611", country); + IsNotValid("ID6767", country); + IsNotValid("JS8752", country); + IsNotValid("KN9999", country); + IsNotValid("LO0000", country); + IsNotValid("ME0144", country); + IsNotValid("NN1282", country); + IsNotValid("OL2037", country); + IsNotValid("PS3243", country); + } + + /// Tests patterns that should not be valid for Montenegro (ME). + [Test] + public void IsNotValidCustomCases_ME_All() + { + var country = Country.MD; + + IsNotValid("00000", country); + IsNotValid("01449", country); + IsNotValid("12823", country); + IsNotValid("20375", country); + IsNotValid("32434", country); + IsNotValid("40082", country); + IsNotValid("56978", country); + IsNotValid("62824", country); + IsNotValid("76113", country); + IsNotValid("67671", country); + IsNotValid("87523", country); + IsNotValid("99999", country); + + IsNotValid("80000", country); + IsNotValid("80149", country); + IsNotValid("82035", country); + IsNotValid("83244", country); + IsNotValid("86284", country); + IsNotValid("87613", country); + IsNotValid("86761", country); + IsNotValid("88753", country); + IsNotValid("89999", country); + } + + /// Tests patterns that should not be valid for Saint Martin (MF). + [Test] + public void IsNotValidCustomCases_MF_All() + { + var country = Country.MF; + + IsNotValid("00000", country); + IsNotValid("01235", country); + IsNotValid("12346", country); + IsNotValid("20004", country); + IsNotValid("32648", country); + IsNotValid("40945", country); + IsNotValid("56640", country); + IsNotValid("62908", country); + IsNotValid("76345", country); + IsNotValid("67552", country); + IsNotValid("87182", country); + IsNotValid("99999", country); + } + + /// Tests patterns that should not be valid for Madagascar (MG). + [Test] + public void IsNotValidCustomCases_MG_All() + { + var country = Country.MG; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Marshall Islands (MH). + [Test] + public void IsNotValidCustomCases_MH_All() + { + var country = Country.MH; + + IsNotValid("06000", country); + IsNotValid("00425", country); + IsNotValid("11836", country); + IsNotValid("22304", country); + IsNotValid("33468", country); + IsNotValid("44095", country); + IsNotValid("55960", country); + IsNotValid("66898", country); + IsNotValid("77135", country); + IsNotValid("66652", country); + IsNotValid("88512", country); + IsNotValid("99999", country); + IsNotValid("96932", country); + IsNotValid("96951", country); + IsNotValid("96989", country); + IsNotValid("00000", country); + + IsNotValid("000000000", country); + IsNotValid("012345678", country); + IsNotValid("128253436", country); + IsNotValid("203770044", country); + IsNotValid("324336478", country); + IsNotValid("400879475", country); + IsNotValid("569736450", country); + IsNotValid("628269088", country); + IsNotValid("761143495", country); + IsNotValid("676785502", country); + IsNotValid("875291832", country); + IsNotValid("999999999", country); + IsNotValid("000000000", country); + } + + /// Tests patterns that should not be valid for Macedonia (MK). + [Test] + public void IsNotValidCustomCases_MK_All() + { + var country = Country.MK; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Myanmar (MM). + [Test] + public void IsNotValidCustomCases_MM_All() + { + var country = Country.MM; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Mongolia (MN). + [Test] + public void IsNotValidCustomCases_MN_All() + { + var country = Country.MN; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Northern Mariana Islands (MP). + [Test] + public void IsNotValidCustomCases_MP_All() + { + var country = Country.MP; + + IsNotValid("00000", country); + IsNotValid("01235", country); + IsNotValid("12346", country); + IsNotValid("20004", country); + IsNotValid("32648", country); + IsNotValid("40945", country); + IsNotValid("56640", country); + IsNotValid("62908", country); + IsNotValid("76345", country); + IsNotValid("67552", country); + IsNotValid("87182", country); + IsNotValid("99999", country); + IsNotValid("96949", country); + IsNotValid("96953", country); + IsNotValid("96954", country); + IsNotValid("000000000", country); + IsNotValid("012354423", country); + IsNotValid("123462534", country); + IsNotValid("200047700", country); + IsNotValid("326483364", country); + IsNotValid("409458794", country); + IsNotValid("566407364", country); + IsNotValid("629082690", country); + IsNotValid("763451434", country); + IsNotValid("675527855", country); + IsNotValid("871822918", country); + IsNotValid("969496831", country); + IsNotValid("969535348", country); + IsNotValid("969545607", country); + IsNotValid("999999999", country); + } + + /// Tests patterns that should not be valid for Martinique (MQ). + [Test] + public void IsNotValidCustomCases_MQ_All() + { + var country = Country.MQ; + + IsNotValid("00000", country); + IsNotValid("01235", country); + IsNotValid("12346", country); + IsNotValid("20004", country); + IsNotValid("32648", country); + IsNotValid("40945", country); + IsNotValid("56640", country); + IsNotValid("62908", country); + IsNotValid("76345", country); + IsNotValid("67552", country); + IsNotValid("87182", country); + IsNotValid("99999", country); + } + + /// Tests patterns that should not be valid for Malta (MT). + [Test] + public void IsNotValidCustomCases_MT_All() + { + var country = Country.MT; + + IsNotValid("AA00000", country); + IsNotValid("ASD01D2", country); + } + + /// Tests patterns that should not be valid for Mexico (MX). + [Test] + public void IsNotValidCustomCases_MX_All() + { + var country = Country.MX; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Malaysia (MY). + [Test] + public void IsNotValidCustomCases_MY_All() + { + var country = Country.MY; + + IsNotValid("00000", country); + IsNotValid("00035", country); + IsNotValid("00146", country); + IsNotValid("00204", country); + IsNotValid("00348", country); + IsNotValid("00445", country); + IsNotValid("00540", country); + IsNotValid("00608", country); + IsNotValid("00745", country); + IsNotValid("00652", country); + IsNotValid("00882", country); + IsNotValid("00999", country); + } + + /// Tests patterns that should not be valid for Mozambique (MZ). + [Test] + public void IsNotValidCustomCases_MZ_All() + { + var country = Country.MZ; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Namibia (NA). + [Test] + public void IsNotValidCustomCases_NA_All() + { + var country = Country.NA; + + IsNotValid("00000", country); + IsNotValid("01235", country); + IsNotValid("12346", country); + IsNotValid("20004", country); + IsNotValid("32648", country); + IsNotValid("40945", country); + IsNotValid("56640", country); + IsNotValid("62908", country); + IsNotValid("76345", country); + IsNotValid("67552", country); + IsNotValid("87182", country); + IsNotValid("89999", country); + IsNotValid("93000", country); + IsNotValid("99999", country); + } + + /// Tests patterns that should not be valid for New Caledonia (NC). + [Test] + public void IsNotValidCustomCases_NC_All() + { + var country = Country.NC; + + IsNotValid("00000", country); + IsNotValid("01235", country); + IsNotValid("12346", country); + IsNotValid("20004", country); + IsNotValid("32648", country); + IsNotValid("40945", country); + IsNotValid("56640", country); + IsNotValid("62908", country); + IsNotValid("76345", country); + IsNotValid("67552", country); + IsNotValid("87182", country); + IsNotValid("99999", country); + + IsNotValid("98600", country); + IsNotValid("98535", country); + IsNotValid("98346", country); + IsNotValid("98204", country); + IsNotValid("98648", country); + IsNotValid("98545", country); + IsNotValid("98140", country); + IsNotValid("98108", country); + IsNotValid("99045", country); + IsNotValid("99052", country); + IsNotValid("97982", country); + IsNotValid("99999", country); + } + + /// Tests patterns that should not be valid for Niger (NE). + [Test] + public void IsNotValidCustomCases_NE_All() + { + var country = Country.NE; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Norfolk Island (NF). + [Test] + public void IsNotValidCustomCases_NF_All() + { + var country = Country.NF; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Nigeria (NG). + [Test] + public void IsNotValidCustomCases_NG_All() + { + var country = Country.NG; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Nicaragua (NI). + [Test] + public void IsNotValidCustomCases_NI_All() + { + var country = Country.NI; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Netherlands (NL). + [Test] + public void IsNotValidCustomCases_NL_All() + { + var country = Country.NL; + + IsNotValid("0000DF", country); + IsNotValid("0125DS", country); + IsNotValid("3278SA", country); + IsNotValid("8732SD", country); + IsNotValid("9999SS", country); + } + + /// Tests patterns that should not be valid for Norway (NO). + [Test] + public void IsNotValidCustomCases_NO_All() + { + var country = Country.NO; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Nepal (NP). + [Test] + public void IsNotValidCustomCases_NP_All() + { + var country = Country.NP; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for New Zealand (NZ). + [Test] + public void IsNotValidCustomCases_NZ_All() + { + var country = Country.NZ; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Oman (OM). + [Test] + public void IsNotValidCustomCases_OM_All() + { + var country = Country.OM; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Panama (PA). + [Test] + public void IsNotValidCustomCases_PA_All() + { + var country = Country.PA; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Peru (PE). + [Test] + public void IsNotValidCustomCases_PE_All() + { + var country = Country.PE; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for French Polynesia (PF). + [Test] + public void IsNotValidCustomCases_PF_All() + { + var country = Country.PF; + + IsNotValid("00000", country); + IsNotValid("01235", country); + IsNotValid("12346", country); + IsNotValid("20004", country); + IsNotValid("32648", country); + IsNotValid("40945", country); + IsNotValid("56640", country); + IsNotValid("62908", country); + IsNotValid("76345", country); + IsNotValid("67552", country); + IsNotValid("87182", country); + IsNotValid("98524", country); + IsNotValid("98600", country); + IsNotValid("98805", country); + IsNotValid("98916", country); + IsNotValid("99999", country); + } + + /// Tests patterns that should not be valid for Papua New Guinea (PG). + [Test] + public void IsNotValidCustomCases_PG_All() + { + var country = Country.PG; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Philippines (PH). + [Test] + public void IsNotValidCustomCases_PH_All() + { + var country = Country.PH; + + IsNotValid("0000", country); + IsNotValid("0003", country); + IsNotValid("0014", country); + IsNotValid("0020", country); + IsNotValid("0034", country); + IsNotValid("0044", country); + IsNotValid("0054", country); + IsNotValid("0060", country); + IsNotValid("0074", country); + IsNotValid("0065", country); + IsNotValid("0088", country); + IsNotValid("0099", country); + } + + /// Tests patterns that should not be valid for Pakistan (PK). + [Test] + public void IsNotValidCustomCases_PK_All() + { + var country = Country.PK; + + IsNotValid("00000", country); + IsNotValid("00125", country); + IsNotValid("01236", country); + IsNotValid("02004", country); + IsNotValid("03268", country); + IsNotValid("04095", country); + IsNotValid("05660", country); + IsNotValid("06298", country); + IsNotValid("07635", country); + IsNotValid("06752", country); + IsNotValid("08712", country); + IsNotValid("09854", country); + IsNotValid("09860", country); + IsNotValid("09885", country); + IsNotValid("09896", country); + IsNotValid("09999", country); + } + + /// Tests patterns that should not be valid for Poland (PL). + [Test] + public void IsNotValidCustomCases_PL_All() + { + var country = Country.PL; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Saint Pierre And Miquelon (PM). + [Test] + public void IsNotValidCustomCases_PM_All() + { + var country = Country.PM; + + IsNotValid("00000", country); + IsNotValid("01235", country); + IsNotValid("12346", country); + IsNotValid("20004", country); + IsNotValid("32648", country); + IsNotValid("40945", country); + IsNotValid("56640", country); + IsNotValid("62908", country); + IsNotValid("76345", country); + IsNotValid("67552", country); + IsNotValid("87182", country); + IsNotValid("97000", country); + IsNotValid("97101", country); + IsNotValid("97212", country); + IsNotValid("97320", country); + IsNotValid("97432", country); + IsNotValid("97640", country); + IsNotValid("97756", country); + IsNotValid("97862", country); + IsNotValid("97976", country); + IsNotValid("99999", country); + IsNotValid("97502", country); + IsNotValid("97513", country); + IsNotValid("97520", country); + IsNotValid("97536", country); + IsNotValid("97549", country); + IsNotValid("97556", country); + IsNotValid("97569", country); + IsNotValid("97573", country); + IsNotValid("97565", country); + IsNotValid("97581", country); + IsNotValid("97599", country); + } + + /// Tests patterns that should not be valid for Pitcairn (PN). + [Test] + public void IsNotValidCustomCases_PN_All() + { + var country = Country.PN; + + IsNotValid("PCRN2ZZ", country); + IsNotValid("AADF0FD", country); + IsNotValid("ASDS0KD", country); + IsNotValid("BJRF1DR", country); + IsNotValid("CDWK2JW", country); + IsNotValid("DESD3FS", country); + IsNotValid("EOPJ4SP", country); + IsNotValid("FNKF5DK", country); + IsNotValid("GFLS6OL", country); + IsNotValid("HLJD7FJ", country); + IsNotValid("IDMO6SM", country); + IsNotValid("JSDF8FD", country); + IsNotValid("KNJS9SJ", country); + IsNotValid("LODF0FD", country); + IsNotValid("MEDS0KD", country); + IsNotValid("NNRF1RF", country); + IsNotValid("OLWK2WS", country); + IsNotValid("PSSD3SF", country); + IsNotValid("QDPJ4PK", country); + IsNotValid("RNKF5KD", country); + IsNotValid("SELS6LJ", country); + IsNotValid("TMJD7JF", country); + IsNotValid("UFMO6MS", country); + IsNotValid("VEDF8DD", country); + IsNotValid("WLJS9JO", country); + IsNotValid("XMDF0DF", country); + IsNotValid("YEDS0DS", country); + IsNotValid("ZLRF1RF", country); + IsNotValid("ZZWK2WS", country); + } + + /// Tests patterns that should not be valid for Puerto Rico (PR). + [Test] + public void IsNotValidCustomCases_PR_All() + { + var country = Country.PR; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Palestinian Territory (PS). + [Test] + public void IsNotValidCustomCases_PS_All() + { + var country = Country.PS; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Portugal (PT). + [Test] + public void IsNotValidCustomCases_PT_All() + { + var country = Country.PT; + + IsNotValid("0000000", country); + IsNotValid("0014494", country); + IsNotValid("0123456", country); + IsNotValid("0203757", country); + IsNotValid("0324343", country); + IsNotValid("0400827", country); + IsNotValid("0569783", country); + IsNotValid("0628246", country); + IsNotValid("0761134", country); + IsNotValid("0676718", country); + IsNotValid("0875239", country); + IsNotValid("0999999", country); + } + + /// Tests patterns that should not be valid for Palau (PW). + [Test] + public void IsNotValidCustomCases_PW_All() + { + var country = Country.PW; + + IsNotValid("01235", country); + IsNotValid("12346", country); + IsNotValid("20004", country); + IsNotValid("32648", country); + IsNotValid("40945", country); + IsNotValid("56640", country); + IsNotValid("62908", country); + IsNotValid("76345", country); + IsNotValid("67552", country); + IsNotValid("87182", country); + IsNotValid("96939", country); + IsNotValid("96941", country); + IsNotValid("96948", country); + IsNotValid("96952", country); + IsNotValid("99999", country); + } + + /// Tests patterns that should not be valid for Paraguay (PY). + [Test] + public void IsNotValidCustomCases_PY_All() + { + var country = Country.PY; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Réunion (RE). + [Test] + public void IsNotValidCustomCases_RE_All() + { + var country = Country.RE; + + IsNotValid("00000", country); + IsNotValid("01235", country); + IsNotValid("12346", country); + IsNotValid("20004", country); + IsNotValid("32648", country); + IsNotValid("40945", country); + IsNotValid("56640", country); + IsNotValid("62908", country); + IsNotValid("76345", country); + IsNotValid("67552", country); + IsNotValid("87182", country); + IsNotValid("97000", country); + IsNotValid("97102", country); + IsNotValid("97213", country); + IsNotValid("97320", country); + IsNotValid("97536", country); + IsNotValid("97649", country); + IsNotValid("97756", country); + IsNotValid("97869", country); + IsNotValid("97973", country); + IsNotValid("99999", country); + } + + /// Tests patterns that should not be valid for Romania (RO). + [Test] + public void IsNotValidCustomCases_RO_All() + { + var country = Country.RO; + + IsNotValid("00000", country); + IsNotValid("00012", country); + IsNotValid("00123", country); + IsNotValid("00200", country); + IsNotValid("00326", country); + IsNotValid("00409", country); + IsNotValid("00566", country); + IsNotValid("00629", country); + IsNotValid("00763", country); + IsNotValid("00675", country); + IsNotValid("00871", country); + IsNotValid("00970", country); + IsNotValid("00999", country); + } + + /// Tests patterns that should not be valid for Serbia (RS). + [Test] + public void IsNotValidCustomCases_RS_All() + { + var country = Country.RS; + + IsNotValid("000000", country); + IsNotValid("012345", country); + IsNotValid("400827", country); + IsNotValid("569783", country); + IsNotValid("628246", country); + IsNotValid("761134", country); + IsNotValid("676718", country); + IsNotValid("875239", country); + IsNotValid("999999", country); + } + + /// Tests patterns that should not be valid for Russian Federation (RU). + [Test] + public void IsNotValidCustomCases_RU_All() + { + var country = Country.RU; + + IsNotValid("0000000", country); + IsNotValid("0012345", country); + IsNotValid("0128235", country); + IsNotValid("0203757", country); + IsNotValid("0324343", country); + IsNotValid("0400827", country); + IsNotValid("0569783", country); + IsNotValid("0628246", country); + IsNotValid("0761134", country); + IsNotValid("0676718", country); + IsNotValid("0875239", country); + IsNotValid("0999999", country); + } + + /// Tests patterns that should not be valid for Saudi Arabia (SA). + [Test] + public void IsNotValidCustomCases_SA_All() + { + var country = Country.SA; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Sudan (SD). + [Test] + public void IsNotValidCustomCases_SD_All() + { + var country = Country.SD; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Sweden (SE). + [Test] + public void IsNotValidCustomCases_SE_All() + { + var country = Country.SE; + + IsNotValid("000000", country); + IsNotValid("001235", country); + IsNotValid("012825", country); + IsNotValid("020377", country); + IsNotValid("032433", country); + IsNotValid("040087", country); + IsNotValid("056973", country); + IsNotValid("062826", country); + IsNotValid("076114", country); + IsNotValid("067678", country); + IsNotValid("087529", country); + IsNotValid("099999", country); + } + + /// Tests patterns that should not be valid for Singapore (SG). + [Test] + public void IsNotValidCustomCases_SG_All() + { + var country = Country.SG; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Saint Helena (SH). + [Test] + public void IsNotValidCustomCases_SH_All() + { + var country = Country.SH; + + IsNotValid("SAHL1ZZ", country); + IsNotValid("STBL1AZ", country); + IsNotValid("STHL2ZZ", country); + IsNotValid("AADF0DF", country); + IsNotValid("ASDS2DS", country); + IsNotValid("BJRF3RF", country); + IsNotValid("CDWK4WK", country); + IsNotValid("DESD7SD", country); + IsNotValid("EOPJ7PJ", country); + IsNotValid("FNKF5KF", country); + IsNotValid("GFLS8LS", country); + IsNotValid("HLJD9JD", country); + IsNotValid("IDMO0MO", country); + IsNotValid("JSDF3DF", country); + IsNotValid("KNJS9JS", country); + IsNotValid("LODF0DF", country); + IsNotValid("MEDS2DS", country); + IsNotValid("NNRF3RF", country); + IsNotValid("OLWK4WK", country); + IsNotValid("PSSD7SD", country); + IsNotValid("QDPJ7PJ", country); + IsNotValid("RNKF5KF", country); + IsNotValid("SELS8LS", country); + IsNotValid("TMJD9JD", country); + IsNotValid("UFMO0MO", country); + IsNotValid("VEDF3DF", country); + IsNotValid("WLJS9JS", country); + IsNotValid("XMDF0DF", country); + IsNotValid("YEDS2DS", country); + IsNotValid("ZLRF3RF", country); + IsNotValid("ZZWK4WK", country); + } + + /// Tests patterns that should not be valid for Slovenia (SI). + [Test] + public void IsNotValidCustomCases_SI_All() + { + var country = Country.SI; + + IsNotValid("AA0000", country); + IsNotValid("AS0144", country); + IsNotValid("BJ1282", country); + IsNotValid("CD2037", country); + IsNotValid("DE3243", country); + IsNotValid("EO4008", country); + IsNotValid("FN5697", country); + IsNotValid("GF6282", country); + IsNotValid("HL7611", country); + IsNotValid("ID6767", country); + IsNotValid("JS8752", country); + IsNotValid("KN9999", country); + IsNotValid("LO0000", country); + IsNotValid("ME0144", country); + IsNotValid("NN1282", country); + IsNotValid("OL2037", country); + IsNotValid("PS3243", country); + IsNotValid("QD4008", country); + IsNotValid("RN5697", country); + IsNotValid("SE6282", country); + IsNotValid("TM7611", country); + IsNotValid("UF6767", country); + IsNotValid("VE8752", country); + IsNotValid("WL9999", country); + IsNotValid("XM0000", country); + IsNotValid("YE0144", country); + IsNotValid("ZL1282", country); + IsNotValid("ZZ2037", country); + } + + /// Tests patterns that should not be valid for Slovakia (SK). + [Test] + public void IsNotValidCustomCases_SK_All() + { + var country = Country.SK; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for San Marino (SM). + [Test] + public void IsNotValidCustomCases_SM_All() + { + var country = Country.SM; + + IsNotValid("00000", country); + IsNotValid("05125", country); + IsNotValid("16285", country); + IsNotValid("27037", country); + IsNotValid("36243", country); + IsNotValid("46890", country); + IsNotValid("47797", country); + IsNotValid("59693", country); + IsNotValid("66286", country); + IsNotValid("76614", country); + IsNotValid("66768", country); + IsNotValid("83759", country); + IsNotValid("99999", country); + } + + /// Tests patterns that should not be valid for Senegal (SN). + [Test] + public void IsNotValidCustomCases_SN_All() + { + var country = Country.SN; + + IsNotValid("AA00000", country); + IsNotValid("AB01234", country); + IsNotValid("BJ12823", country); + IsNotValid("CO20375", country); + IsNotValid("DE32434", country); + IsNotValid("EO40082", country); + IsNotValid("FN56978", country); + IsNotValid("GF62824", country); + IsNotValid("HL76113", country); + IsNotValid("ID67671", country); + IsNotValid("JS87523", country); + IsNotValid("KN99999", country); + IsNotValid("LO00000", country); + IsNotValid("ME01449", country); + IsNotValid("NN12823", country); + IsNotValid("OL20375", country); + IsNotValid("PS32434", country); + IsNotValid("QD40082", country); + IsNotValid("RN56978", country); + IsNotValid("SE62824", country); + IsNotValid("TM76113", country); + IsNotValid("UF67671", country); + IsNotValid("VE87523", country); + IsNotValid("WL99999", country); + IsNotValid("XM00000", country); + IsNotValid("YE01449", country); + IsNotValid("ZL12823", country); + IsNotValid("ZZ20375", country); + } + + /// Tests patterns that should not be valid for El Salvador (SV). + [Test] + public void IsNotValidCustomCases_SV_All() + { + var country = Country.SV; + + IsNotValid("00000", country); + IsNotValid("01001", country); + IsNotValid("01131", country); + IsNotValid("02131", country); + IsNotValid("02331", country); + IsNotValid("12234", country); + IsNotValid("27000", country); + IsNotValid("33248", country); + IsNotValid("48945", country); + IsNotValid("57640", country); + IsNotValid("62208", country); + IsNotValid("71645", country); + IsNotValid("67752", country); + IsNotValid("82782", country); + IsNotValid("99999", country); + } + + /// Tests patterns that should not be valid for Swaziland (SZ). + [Test] + public void IsNotValidCustomCases_SZ_All() + { + var country = Country.SZ; + + IsNotValid("A000", country); + IsNotValid("A014", country); + IsNotValid("B128", country); + IsNotValid("C203", country); + IsNotValid("D324", country); + IsNotValid("E400", country); + IsNotValid("F569", country); + IsNotValid("G628", country); + IsNotValid("I676", country); + IsNotValid("J875", country); + IsNotValid("K999", country); + IsNotValid("N128", country); + IsNotValid("O203", country); + IsNotValid("P324", country); + IsNotValid("Q400", country); + IsNotValid("R569", country); + IsNotValid("T761", country); + IsNotValid("U676", country); + IsNotValid("V875", country); + IsNotValid("W999", country); + IsNotValid("X000", country); + IsNotValid("Y014", country); + IsNotValid("Z128", country); + IsNotValid("Z999", country); + + IsNotValid("A00Z", country); + IsNotValid("0A14", country); + IsNotValid("1B28", country); + IsNotValid("2C03", country); + IsNotValid("3D24", country); + IsNotValid("E40A", country); + IsNotValid("F5B9", country); + IsNotValid("G6BB", country); + IsNotValid("H7A1", country); + IsNotValid("I6A6", country); + IsNotValid("875J", country); + IsNotValid("999K", country); + IsNotValid("000L", country); + IsNotValid("014M", country); + IsNotValid("128N", country); + IsNotValid("203O", country); + IsNotValid("324P", country); + IsNotValid("Q4J0", country); + IsNotValid("R5K6", country); + IsNotValid("S6L2", country); + IsNotValid("T7M6", country); + IsNotValid("U6N7", country); + IsNotValid("V8O7", country); + } + + /// Tests patterns that should not be valid for Turks And Caicos Islands (TC). + [Test] + public void IsNotValidCustomCases_TC_All() + { + var country = Country.TC; + + IsNotValid("AKCA1ZZ", country); + IsNotValid("TBCA1ZZ", country); + IsNotValid("TKDA1ZZ", country); + IsNotValid("TKCE1ZZ", country); + IsNotValid("TKCA9ZZ", country); + IsNotValid("TKCA1FZ", country); + IsNotValid("TKCA1ZG", country); + + IsNotValid("AADF0DF", country); + IsNotValid("ASDS0DS", country); + IsNotValid("BJRF1RF", country); + IsNotValid("CDWK2WK", country); + IsNotValid("DESD3SD", country); + IsNotValid("EOPJ4PJ", country); + IsNotValid("FNKF5KF", country); + IsNotValid("GFLS6LS", country); + IsNotValid("HLJD7JD", country); + IsNotValid("IDMO6MO", country); + IsNotValid("JSDF8DF", country); + IsNotValid("KNJS9JS", country); + IsNotValid("LODF0DF", country); + IsNotValid("MEDS0DS", country); + IsNotValid("NNRF1RF", country); + IsNotValid("OLWK2WK", country); + IsNotValid("PSSD3SD", country); + IsNotValid("QDPJ4PJ", country); + IsNotValid("RNKF5KF", country); + IsNotValid("SELS6LS", country); + IsNotValid("TMJD7JD", country); + IsNotValid("UFMO6MO", country); + IsNotValid("VEDF8DF", country); + IsNotValid("WLJS9JS", country); + IsNotValid("XMDF0DF", country); + IsNotValid("YEDS0DS", country); + IsNotValid("ZLRF1RF", country); + IsNotValid("ZZWK2WK", country); + } + + /// Tests patterns that should not be valid for Chad (TD). + [Test] + public void IsNotValidCustomCases_TD_All() + { + var country = Country.TD; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Thailand (TH). + [Test] + public void IsNotValidCustomCases_TH_All() + { + var country = Country.TH; + + IsNotValid("00000", country); + IsNotValid("00124", country); + IsNotValid("01283", country); + IsNotValid("02035", country); + IsNotValid("03244", country); + IsNotValid("04002", country); + IsNotValid("05698", country); + IsNotValid("06284", country); + IsNotValid("07613", country); + IsNotValid("06761", country); + IsNotValid("08753", country); + IsNotValid("09999", country); + } + + /// Tests patterns that should not be valid for Tajikistan (TJ). + [Test] + public void IsNotValidCustomCases_TJ_All() + { + var country = Country.TJ; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Turkmenistan (TM). + [Test] + public void IsNotValidCustomCases_TM_All() + { + var country = Country.TM; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Tunisia (TN). + [Test] + public void IsNotValidCustomCases_TN_All() + { + var country = Country.TN; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Turkey (TR). + [Test] + public void IsNotValidCustomCases_TR_All() + { + var country = Country.TR; + + IsNotValid("00000", country); + IsNotValid("00012", country); + IsNotValid("00128", country); + IsNotValid("00203", country); + IsNotValid("00324", country); + IsNotValid("00400", country); + IsNotValid("00569", country); + IsNotValid("00628", country); + IsNotValid("00761", country); + IsNotValid("00676", country); + IsNotValid("00875", country); + IsNotValid("00999", country); + } + + /// Tests patterns that should not be valid for Trinidad And Tobago (TT). + [Test] + public void IsNotValidCustomCases_TT_All() + { + var country = Country.TT; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Taiwan (TW). + [Test] + public void IsNotValidCustomCases_TW_All() + { + var country = Country.TW; + + IsNotValid("000000", country); + IsNotValid("001234", country); + IsNotValid("012823", country); + IsNotValid("020375", country); + IsNotValid("032434", country); + IsNotValid("040082", country); + IsNotValid("056978", country); + IsNotValid("062824", country); + IsNotValid("076113", country); + IsNotValid("067671", country); + IsNotValid("087523", country); + IsNotValid("099999", country); + } + + /// Tests patterns that should not be valid for Ukraine (UA). + [Test] + public void IsNotValidCustomCases_UA_All() + { + var country = Country.UA; + + IsNotValid("00000", country); + IsNotValid("00012", country); + IsNotValid("00123", country); + IsNotValid("00200", country); + IsNotValid("00326", country); + IsNotValid("00409", country); + IsNotValid("00566", country); + IsNotValid("00629", country); + IsNotValid("00763", country); + IsNotValid("00675", country); + IsNotValid("00871", country); + IsNotValid("00999", country); + } + + /// Tests patterns that should not be valid for United States (US). + [Test] + public void IsNotValidCustomCases_US_All() + { + var country = Country.US; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Uruguay (UY). + [Test] + public void IsNotValidCustomCases_UY_All() + { + var country = Country.UY; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Holy See (VA). + [Test] + public void IsNotValidCustomCases_VA_All() + { + var country = Country.VA; + + IsNotValid("00000", country); + IsNotValid("01234", country); + IsNotValid("12823", country); + IsNotValid("20375", country); + IsNotValid("32434", country); + IsNotValid("40082", country); + IsNotValid("56978", country); + IsNotValid("62824", country); + IsNotValid("76113", country); + IsNotValid("67671", country); + IsNotValid("87523", country); + IsNotValid("99999", country); + } + + /// Tests patterns that should not be valid for Saint Vincent And The Grenadines (VC). + [Test] + public void IsNotValidCustomCases_VC_All() + { + var country = Country.VC; + + IsNotValid("AA0000", country); + IsNotValid("AS0144", country); + IsNotValid("BJ1282", country); + IsNotValid("CD2037", country); + IsNotValid("DE3243", country); + IsNotValid("EO4008", country); + IsNotValid("FN5697", country); + IsNotValid("GF6282", country); + IsNotValid("HL7611", country); + IsNotValid("ID6767", country); + IsNotValid("JS8752", country); + IsNotValid("KN9999", country); + IsNotValid("LO0000", country); + IsNotValid("ME0144", country); + IsNotValid("NN1282", country); + IsNotValid("OL2037", country); + IsNotValid("PS3243", country); + IsNotValid("QD4008", country); + IsNotValid("RN5697", country); + IsNotValid("SE6282", country); + IsNotValid("TM7611", country); + IsNotValid("UF6767", country); + IsNotValid("VE8752", country); + IsNotValid("WL9999", country); + IsNotValid("XM0000", country); + IsNotValid("YE0144", country); + IsNotValid("ZL1282", country); + IsNotValid("ZZ2037", country); + } + + /// Tests patterns that should not be valid for Venezuela (VE). + [Test] + public void IsNotValidCustomCases_VE_All() + { + var country = Country.VE; + + IsNotValid("00000", country); + IsNotValid("01223", country); + IsNotValid("12334", country); + IsNotValid("20400", country); + IsNotValid("32764", country); + IsNotValid("40794", country); + IsNotValid("56564", country); + IsNotValid("62890", country); + IsNotValid("76934", country); + IsNotValid("67055", country); + IsNotValid("87318", country); + IsNotValid("99999", country); + + IsNotValid("000A", country); + IsNotValid("032A", country); + IsNotValid("143B", country); + IsNotValid("204C", country); + IsNotValid("347D", country); + IsNotValid("447E", country); + IsNotValid("545F", country); + IsNotValid("608G", country); + IsNotValid("749H", country); + IsNotValid("J650I", country); + IsNotValid("K8832", country); + IsNotValid("L9999", country); + IsNotValid("M0000", country); + IsNotValid("N0325", country); + IsNotValid("O1436", country); + IsNotValid("20412", country); + IsNotValid("34787", country); + IsNotValid("44757", country); + IsNotValid("54505", country); + IsNotValid("60888", country); + } + + /// Tests patterns that should not be valid for Virgin Islands (VG). + [Test] + public void IsNotValidCustomCases_VG_All() + { + var country = Country.VG; + + IsNotValid("0123", country); + IsNotValid("1187", country); + IsNotValid("1199", country); + IsNotValid("1234", country); + IsNotValid("2000", country); + IsNotValid("3248", country); + IsNotValid("4945", country); + IsNotValid("5640", country); + IsNotValid("6208", country); + IsNotValid("7645", country); + IsNotValid("6752", country); + IsNotValid("8782", country); + IsNotValid("9999", country); + + IsNotValid("VG0123", country); + IsNotValid("VG1187", country); + IsNotValid("VG1199", country); + IsNotValid("VG1234", country); + IsNotValid("VG2000", country); + IsNotValid("VG3248", country); + IsNotValid("VG4945", country); + IsNotValid("VG5640", country); + IsNotValid("VG6208", country); + IsNotValid("VG7645", country); + IsNotValid("VG6752", country); + IsNotValid("VG8782", country); + IsNotValid("VG9999", country); + } + + /// Tests patterns that should not be valid for Virgin Islands (VI). + [Test] + public void IsNotValidCustomCases_VI_All() + { + var country = Country.VI; + + IsNotValid("00000", country); + IsNotValid("01235", country); + IsNotValid("12346", country); + IsNotValid("20004", country); + IsNotValid("32648", country); + IsNotValid("40945", country); + IsNotValid("56640", country); + IsNotValid("62908", country); + IsNotValid("76345", country); + IsNotValid("67552", country); + IsNotValid("87182", country); + IsNotValid("99999", country); + IsNotValid("000000000", country); + IsNotValid("013582794", country); + IsNotValid("124678364", country); + IsNotValid("200424690", country); + IsNotValid("324813434", country); + IsNotValid("404571855", country); + IsNotValid("564023918", country); + IsNotValid("620899999", country); + IsNotValid("764500000", country); + IsNotValid("675249423", country); + IsNotValid("878227947", country); + IsNotValid("999999999", country); + + IsNotValid("00800", country); + IsNotValid("00804", country); + IsNotValid("00869", country); + IsNotValid("00870", country); + IsNotValid("00860", country); + IsNotValid("00881", country); + IsNotValid("00892", country); + IsNotValid("008000000", country); + IsNotValid("008041235", country); + IsNotValid("008692908", country); + IsNotValid("008706345", country); + IsNotValid("008607552", country); + IsNotValid("008817182", country); + IsNotValid("008929999", country); + } + + /// Tests patterns that should not be valid for Viet Nam (VN). + [Test] + public void IsNotValidCustomCases_VN_All() + { + var country = Country.VN; + + IsNotValid("0", country); + } + + /// Tests patterns that should not be valid for Wallis And Futuna (WF). + [Test] + public void IsNotValidCustomCases_WF_All() + { + var country = Country.WF; + + IsNotValid("00000", country); + IsNotValid("01235", country); + IsNotValid("12346", country); + IsNotValid("20004", country); + IsNotValid("32648", country); + IsNotValid("40945", country); + IsNotValid("56640", country); + IsNotValid("62908", country); + IsNotValid("76345", country); + IsNotValid("67552", country); + IsNotValid("87182", country); + IsNotValid("99999", country); + } + + /// Tests patterns that should not be valid for Mayotte (YT). + [Test] + public void IsNotValidCustomCases_YT_All() + { + var country = Country.YT; + + IsNotValid("M11AA", country); + IsNotValid("M11aA", country); + IsNotValid("M11AA", country); + IsNotValid("m11AA", country); + IsNotValid("m11aa", country); + + IsNotValid("B338TH", country); + IsNotValid("B338TH", country); + + IsNotValid("CR26XH", country); + IsNotValid("CR26XH", country); + + IsNotValid("DN551PT", country); + IsNotValid("DN551PT", country); + + IsNotValid("W1A1HQ", country); + IsNotValid("W1A1HQ", country); + + IsNotValid("EC1A1BB", country); + IsNotValid("EC1A1BB", country); + } + + /// Tests patterns that should not be valid for South Africa (ZA). + [Test] + public void IsNotValidCustomCases_ZA_All() + { + var country = Country.ZA; + + IsNotValid("0000", country); + } + + /// Tests patterns that should not be valid for Zambia (ZM). + [Test] + public void IsNotValidCustomCases_ZM_All() + { + var country = Country.ZM; + + IsNotValid("0", country); + } + + #endregion + /// Tests patterns that should not be valid for Andorra (AD). [Test] public void IsNotValid_AD_All() diff --git a/test/Qowaiv.UnitTests/PostalCodeTest.cs b/test/Qowaiv.UnitTests/PostalCodeTest.cs index 0bf86d3df..68610d642 100644 --- a/test/Qowaiv.UnitTests/PostalCodeTest.cs +++ b/test/Qowaiv.UnitTests/PostalCodeTest.cs @@ -129,11 +129,9 @@ public void IsEmptyOrUnknown_TestStruct_IsFalse() [Test] public void TyrParse_Null_IsValid() { - PostalCode val; - string str = null; - Assert.IsTrue(PostalCode.TryParse(str, out val), "Valid"); + Assert.IsTrue(PostalCode.TryParse(str, out var val), "Valid"); Assert.AreEqual(string.Empty, val.ToString(), "Value"); } @@ -141,11 +139,9 @@ public void TyrParse_Null_IsValid() [Test] public void TyrParse_StringEmpty_IsValid() { - PostalCode val; - string str = string.Empty; - Assert.IsTrue(PostalCode.TryParse(str, out val), "Valid"); + Assert.IsTrue(PostalCode.TryParse(str, out var val), "Valid"); Assert.AreEqual(string.Empty, val.ToString(), "Value"); } @@ -153,11 +149,9 @@ public void TyrParse_StringEmpty_IsValid() [Test] public void TyrParse_StringValue_IsValid() { - PostalCode val; - string str = "H0H0H0"; - Assert.IsTrue(PostalCode.TryParse(str, out val), "Valid"); + Assert.IsTrue(PostalCode.TryParse(str, out var val), "Valid"); Assert.AreEqual(str, val.ToString(), "Value"); } @@ -165,11 +159,9 @@ public void TyrParse_StringValue_IsValid() [Test] public void TyrParse_StringValue_IsNotValid() { - PostalCode val; - string str = "1"; - Assert.IsFalse(PostalCode.TryParse(str, out val), "Valid"); + Assert.IsFalse(PostalCode.TryParse(str, out var val), "Valid"); Assert.AreEqual(string.Empty, val.ToString(), "Value"); } @@ -231,7 +223,7 @@ public void Constructor_SerializationInfoIsNull_ThrowsArgumentNullException() ExceptionAssert.CatchArgumentNullException (() => { - SerializationTest.DeserializeUsingConstructor(null, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(null, default); }, "info"); } @@ -243,7 +235,7 @@ public void Constructor_InvalidSerializationInfo_ThrowsSerializationException() (() => { var info = new SerializationInfo(typeof(PostalCode), new System.Runtime.Serialization.FormatterConverter()); - SerializationTest.DeserializeUsingConstructor(info, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(info, default); }); } @@ -254,7 +246,7 @@ public void GetObjectData_Null_ThrowsArgumentNullException() (() => { ISerializable obj = TestStruct; - obj.GetObjectData(null, default(StreamingContext)); + obj.GetObjectData(null, default); }, "info"); } @@ -264,7 +256,7 @@ public void GetObjectData_SerializationInfo_AreEqual() { ISerializable obj = TestStruct; var info = new SerializationInfo(typeof(PostalCode), new System.Runtime.Serialization.FormatterConverter()); - obj.GetObjectData(info, default(StreamingContext)); + obj.GetObjectData(info, default); Assert.AreEqual(TestStruct.ToString(), info.GetString("Value")); } @@ -2828,3213 +2820,6 @@ private static void IsValid(string postalcode, Country country) #endregion - #region IsNotValid Country tests - - /// Tests patterns that should not be valid for Andorra (AD). - [Test] - public void IsNotValidCustomCases_AD_All() - { - var country = Country.AD; - - IsNotValid("AD890", country); - IsNotValid("AD901", country); - IsNotValid("AD012", country); - } - - /// Tests patterns that should not be valid for Afghanistan (AF). - [Test] - public void IsNotValidCustomCases_AF_All() - { - var country = Country.AF; - - IsNotValid("0077", country); - IsNotValid("5301", country); - IsNotValid("6001", country); - IsNotValid("7023", country); - IsNotValid("8100", country); - IsNotValid("9020", country); - IsNotValid("4441", country); - IsNotValid("4300", country); - } - - /// Tests patterns that should not be valid for Anguilla (AI). - [Test] - public void IsNotValidCustomCases_AI_All() - { - var country = Country.AI; - - IsNotValid("9218", country); - IsNotValid("AI1890", country); - IsNotValid("AI2901", country); - IsNotValid("AI2012", country); - } - - /// Tests patterns that should not be valid for Albania (AL). - [Test] - public void IsNotValidCustomCases_AL_All() - { - var country = Country.AL; - - IsNotValid("0000", country); - IsNotValid("0125", country); - IsNotValid("0279", country); - IsNotValid("0399", country); - IsNotValid("0418", country); - IsNotValid("0540", country); - IsNotValid("0654", country); - IsNotValid("0790", country); - IsNotValid("0852", country); - IsNotValid("0999", country); - } - - /// Tests patterns that should not be valid for Armenia (AM). - [Test] - public void IsNotValidCustomCases_AM_All() - { - var country = Country.AM; - - IsNotValid("5697", country); - IsNotValid("6282", country); - IsNotValid("7611", country); - IsNotValid("6767", country); - IsNotValid("8752", country); - IsNotValid("9999", country); - } - - /// Tests patterns that should not be valid for Argentina (AR). - [Test] - public void IsNotValidCustomCases_AR_All() - { - var country = Country.AR; - - IsNotValid("A0400XXX", country); - IsNotValid("S03004DD", country); - } - - /// Tests patterns that should not be valid for American Samoa (AS). - [Test] - public void IsNotValidCustomCases_AS_All() - { - var country = Country.AS; - - IsNotValid("00000", country); - IsNotValid("01449", country); - IsNotValid("12823", country); - IsNotValid("20375", country); - IsNotValid("32434", country); - IsNotValid("40082", country); - IsNotValid("56978", country); - IsNotValid("62824", country); - IsNotValid("76113", country); - IsNotValid("67671", country); - IsNotValid("87523", country); - IsNotValid("00000000", country); - IsNotValid("01494232", country); - IsNotValid("12835343", country); - IsNotValid("20357004", country); - IsNotValid("32443647", country); - IsNotValid("40027947", country); - IsNotValid("56983645", country); - IsNotValid("62846908", country); - IsNotValid("76134349", country); - IsNotValid("67618550", country); - IsNotValid("87539183", country); - } - - /// Tests patterns that should not be valid for Austria (AT). - [Test] - public void IsNotValidCustomCases_AT_All() - { - var country = Country.AT; - - IsNotValid("0000", country); - IsNotValid("0014", country); - IsNotValid("0128", country); - IsNotValid("0203", country); - IsNotValid("0324", country); - IsNotValid("0400", country); - IsNotValid("0569", country); - IsNotValid("0628", country); - IsNotValid("0761", country); - IsNotValid("0676", country); - IsNotValid("0875", country); - IsNotValid("0999", country); - } - - /// Tests patterns that should not be valid for Australia (AU). - [Test] - public void IsNotValidCustomCases_AU_All() - { - var country = Country.AU; - - IsNotValid("0000", country); - IsNotValid("0014", country); - IsNotValid("0128", country); - IsNotValid("0203", country); - IsNotValid("0324", country); - IsNotValid("0400", country); - IsNotValid("0569", country); - IsNotValid("0628", country); - IsNotValid("0761", country); - } - - /// Tests patterns that should not be valid for Åland Islands (AX). - [Test] - public void IsNotValidCustomCases_AX_All() - { - var country = Country.AX; - - IsNotValid("0000", country); - IsNotValid("0144", country); - IsNotValid("1282", country); - IsNotValid("2037", country); - IsNotValid("2000", country); - IsNotValid("2014", country); - IsNotValid("2122", country); - IsNotValid("2323", country); - IsNotValid("2408", country); - IsNotValid("2567", country); - IsNotValid("2622", country); - IsNotValid("2761", country); - IsNotValid("2677", country); - IsNotValid("2872", country); - IsNotValid("2999", country); - IsNotValid("0144", country); - IsNotValid("1282", country); - IsNotValid("2037", country); - IsNotValid("3243", country); - IsNotValid("4008", country); - IsNotValid("5697", country); - IsNotValid("6282", country); - IsNotValid("7611", country); - IsNotValid("6767", country); - IsNotValid("8752", country); - IsNotValid("9999", country); - } - - /// Tests patterns that should not be valid for Azerbaijan (AZ). - [Test] - public void IsNotValidCustomCases_AZ_All() - { - var country = Country.AZ; - - IsNotValid("DK 6990", country); - IsNotValid("GL3990", country); - IsNotValid("FO1990", country); - IsNotValid("FO990", country); - } - - /// Tests patterns that should not be valid for Bosnia And Herzegovina (BA). - [Test] - public void IsNotValidCustomCases_BA_All() - { - var country = Country.BA; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Barbados (BB). - [Test] - public void IsNotValidCustomCases_BB_All() - { - var country = Country.BB; - - IsNotValid("AA00000", country); - IsNotValid("AS01449", country); - IsNotValid("BJ12823", country); - IsNotValid("CD20375", country); - IsNotValid("DE32434", country); - IsNotValid("EO40082", country); - IsNotValid("FN56978", country); - IsNotValid("GF62824", country); - IsNotValid("HL76113", country); - IsNotValid("ID67671", country); - IsNotValid("JS87523", country); - IsNotValid("KN99999", country); - IsNotValid("LO00000", country); - IsNotValid("ME01449", country); - IsNotValid("NN12823", country); - IsNotValid("OL20375", country); - IsNotValid("PS32434", country); - IsNotValid("QD40082", country); - IsNotValid("RN56978", country); - IsNotValid("SE62824", country); - IsNotValid("TM76113", country); - IsNotValid("UF67671", country); - IsNotValid("VE87523", country); - IsNotValid("WL99999", country); - IsNotValid("XM00000", country); - IsNotValid("YE01449", country); - IsNotValid("ZL12823", country); - IsNotValid("ZZ20375", country); - } - - /// Tests patterns that should not be valid for Bangladesh (BD). - [Test] - public void IsNotValidCustomCases_BD_All() - { - var country = Country.BD; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Belgium (BE). - [Test] - public void IsNotValidCustomCases_BE_All() - { - var country = Country.BE; - - IsNotValid("0000", country); - IsNotValid("0014", country); - IsNotValid("0128", country); - IsNotValid("0203", country); - IsNotValid("0324", country); - IsNotValid("0400", country); - IsNotValid("0569", country); - IsNotValid("0628", country); - IsNotValid("0761", country); - IsNotValid("0676", country); - IsNotValid("0875", country); - IsNotValid("0999", country); - } - - /// Tests patterns that should not be valid for Bulgaria (BG). - [Test] - public void IsNotValidCustomCases_BG_All() - { - var country = Country.BG; - - IsNotValid("0000", country); - IsNotValid("0014", country); - IsNotValid("0128", country); - IsNotValid("0203", country); - IsNotValid("0324", country); - IsNotValid("0400", country); - IsNotValid("0569", country); - IsNotValid("0628", country); - IsNotValid("0761", country); - IsNotValid("0676", country); - IsNotValid("0875", country); - IsNotValid("0999", country); - } - - /// Tests patterns that should not be valid for Bahrain (BH). - [Test] - public void IsNotValidCustomCases_BH_All() - { - var country = Country.BH; - - IsNotValid("000", country); - IsNotValid("014", country); - IsNotValid("1328", country); - IsNotValid("2037", country); - IsNotValid("3243", country); - IsNotValid("4008", country); - IsNotValid("5697", country); - IsNotValid("6282", country); - IsNotValid("7611", country); - IsNotValid("6767", country); - IsNotValid("8752", country); - IsNotValid("9999", country); - } - - /// Tests patterns that should not be valid for Saint Barthélemy (BL). - [Test] - public void IsNotValidCustomCases_BL_All() - { - var country = Country.BL; - - IsNotValid("00000", country); - IsNotValid("01235", country); - IsNotValid("12346", country); - IsNotValid("20004", country); - IsNotValid("32648", country); - IsNotValid("40945", country); - IsNotValid("56640", country); - IsNotValid("62908", country); - IsNotValid("76345", country); - IsNotValid("67552", country); - IsNotValid("87182", country); - IsNotValid("99999", country); - } - - /// Tests patterns that should not be valid for Bermuda (BM). - [Test] - public void IsNotValidCustomCases_BM_All() - { - var country = Country.BM; - - IsNotValid("A0", country); - IsNotValid("A1", country); - IsNotValid("B2", country); - IsNotValid("C0", country); - IsNotValid("D2", country); - IsNotValid("E0", country); - IsNotValid("6F", country); - IsNotValid("2G", country); - IsNotValid("6H", country); - IsNotValid("7I", country); - IsNotValid("7J", country); - IsNotValid("9K", country); - IsNotValid("0L", country); - IsNotValid("013S", country); - IsNotValid("12RF", country); - IsNotValid("2034", country); - IsNotValid("2A34", country); - } - - /// Tests patterns that should not be valid for Brunei Darussalam (BN). - [Test] - public void IsNotValidCustomCases_BN_All() - { - var country = Country.BN; - - IsNotValid("0000DF", country); - IsNotValid("2325DS", country); - IsNotValid("3436RF", country); - IsNotValid("0044WK", country); - IsNotValid("6478SD", country); - IsNotValid("9475PJ", country); - IsNotValid("6450KF", country); - IsNotValid("9088LS", country); - IsNotValid("3495JD", country); - IsNotValid("5502MO", country); - IsNotValid("1832DF", country); - IsNotValid("K999JS", country); - IsNotValid("L000DF", country); - IsNotValid("M325DS", country); - IsNotValid("N436RF", country); - IsNotValid("O044WK", country); - IsNotValid("P478SD", country); - IsNotValid("Q475PJ", country); - IsNotValid("RN578F", country); - IsNotValid("SE624S", country); - IsNotValid("TM713D", country); - IsNotValid("UF671O", country); - IsNotValid("VE823F", country); - IsNotValid("WL999S", country); - IsNotValid("XMD000", country); - IsNotValid("YED014", country); - IsNotValid("ZLR128", country); - IsNotValid("ZZW203", country); - } - - /// Tests patterns that should not be valid for Bolivia (BO). - [Test] - public void IsNotValidCustomCases_BO_All() - { - var country = Country.BO; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Brazil (BR). - [Test] - public void IsNotValidCustomCases_BR_All() - { - var country = Country.BR; - - IsNotValid("00000000", country); - IsNotValid("00014494", country); - IsNotValid("00128235", country); - IsNotValid("00203757", country); - IsNotValid("00324343", country); - IsNotValid("00400827", country); - IsNotValid("00569783", country); - IsNotValid("00628246", country); - IsNotValid("00761134", country); - IsNotValid("00676718", country); - IsNotValid("00875239", country); - IsNotValid("00999999", country); - } - - /// Tests patterns that should not be valid for Bhutan (BT). - [Test] - public void IsNotValidCustomCases_BT_All() - { - var country = Country.BT; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Belarus (BY). - [Test] - public void IsNotValidCustomCases_BY_All() - { - var country = Country.BY; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Canada (CA). - [Test] - public void IsNotValidCustomCases_CA_All() - { - var country = Country.CA; - - // No D, F, I, O, Q, and U (and W and Z to start with). - - IsNotValid("H0D0H0", country); - IsNotValid("A0F0D0", country); - IsNotValid("A0I1D4", country); - IsNotValid("B1O2R8", country); - IsNotValid("C2Q0W3", country); - IsNotValid("D3U2S4", country); - IsNotValid("E4O0D0", country); - IsNotValid("F5N6F9", country); - IsNotValid("G6F2I8", country); - IsNotValid("D7L6O1", country); - IsNotValid("F6D7Q6", country); - IsNotValid("I8S7U5", country); - IsNotValid("O9N9J9", country); - IsNotValid("Q0O0D0", country); - IsNotValid("U0E1D4", country); - IsNotValid("W1N2R8", country); - IsNotValid("Z2L0W3", country); - } - - /// Tests patterns that should not be valid for Cocos (CC). - [Test] - public void IsNotValidCustomCases_CC_All() - { - var country = Country.CC; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Switzerland (CH). - [Test] - public void IsNotValidCustomCases_CH_All() - { - var country = Country.CH; - - IsNotValid("0000", country); - IsNotValid("0014", country); - IsNotValid("0128", country); - IsNotValid("0203", country); - IsNotValid("0324", country); - IsNotValid("0400", country); - IsNotValid("0569", country); - IsNotValid("0628", country); - IsNotValid("0761", country); - IsNotValid("0676", country); - IsNotValid("0875", country); - IsNotValid("0999", country); - } - - /// Tests patterns that should not be valid for Chile (CL). - [Test] - public void IsNotValidCustomCases_CL_All() - { - var country = Country.CL; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for China (CN). - [Test] - public void IsNotValidCustomCases_CN_All() - { - var country = Country.CN; - - IsNotValid("0000", country); - IsNotValid("0004", country); - IsNotValid("0018", country); - IsNotValid("0023", country); - IsNotValid("0034", country); - IsNotValid("0040", country); - IsNotValid("0059", country); - IsNotValid("0068", country); - IsNotValid("0071", country); - IsNotValid("0066", country); - IsNotValid("0085", country); - IsNotValid("0099", country); - } - - /// Tests patterns that should not be valid for Colombia (CO). - [Test] - public void IsNotValidCustomCases_CO_All() - { - var country = Country.CO; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Costa Rica (CR). - [Test] - public void IsNotValidCustomCases_CR_All() - { - var country = Country.CR; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Cuba (CU). - [Test] - public void IsNotValidCustomCases_CU_All() - { - var country = Country.CU; - - IsNotValid("CP000", country); - IsNotValid("CP035", country); - IsNotValid("CP146", country); - IsNotValid("CP204", country); - IsNotValid("CP348", country); - } - - /// Tests patterns that should not be valid for Cape Verde (CV). - [Test] - public void IsNotValidCustomCases_CV_All() - { - var country = Country.CV; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Christmas Island (CX). - [Test] - public void IsNotValidCustomCases_CX_All() - { - var country = Country.CX; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Cyprus (CY). - [Test] - public void IsNotValidCustomCases_CY_All() - { - var country = Country.CY; - - IsNotValid("0000", country); - IsNotValid("0014", country); - IsNotValid("0128", country); - IsNotValid("0203", country); - IsNotValid("0324", country); - IsNotValid("0400", country); - IsNotValid("0569", country); - IsNotValid("0628", country); - IsNotValid("0761", country); - IsNotValid("0676", country); - IsNotValid("0875", country); - IsNotValid("0999", country); - } - - /// Tests patterns that should not be valid for Czech Republic (CZ). - [Test] - public void IsNotValidCustomCases_CZ_All() - { - var country = Country.CZ; - - IsNotValid("0000", country); - IsNotValid("0014", country); - IsNotValid("0128", country); - IsNotValid("0203", country); - IsNotValid("0324", country); - IsNotValid("0400", country); - IsNotValid("0569", country); - IsNotValid("0628", country); - IsNotValid("0761", country); - IsNotValid("0676", country); - IsNotValid("0875", country); - IsNotValid("0999", country); - - IsNotValid("8000", country); - IsNotValid("8004", country); - IsNotValid("8018", country); - IsNotValid("8023", country); - IsNotValid("8034", country); - IsNotValid("8040", country); - IsNotValid("9059", country); - IsNotValid("9068", country); - IsNotValid("9071", country); - IsNotValid("9066", country); - IsNotValid("9085", country); - IsNotValid("9099", country); - } - - /// Tests patterns that should not be valid for Germany (DE). - [Test] - public void IsNotValidCustomCases_DE_All() - { - var country = Country.DE; - - IsNotValid("00007", country); - IsNotValid("00043", country); - IsNotValid("00188", country); - IsNotValid("00237", country); - IsNotValid("00342", country); - IsNotValid("00401", country); - IsNotValid("00597", country); - IsNotValid("00682", country); - IsNotValid("00719", country); - IsNotValid("00665", country); - IsNotValid("00853", country); - IsNotValid("00999", country); - } - - /// Tests patterns that should not be valid for Denmark (DK). - [Test] - public void IsNotValidCustomCases_DK_All() - { - var country = Country.DK; - - IsNotValid("0000", country); - IsNotValid("0014", country); - IsNotValid("0128", country); - IsNotValid("0203", country); - IsNotValid("0324", country); - IsNotValid("0400", country); - IsNotValid("0569", country); - IsNotValid("0628", country); - IsNotValid("0761", country); - IsNotValid("0676", country); - IsNotValid("0875", country); - IsNotValid("0999", country); - - IsNotValid("DK0000", country); - IsNotValid("DK0014", country); - IsNotValid("DK0128", country); - IsNotValid("DK0203", country); - IsNotValid("DK0324", country); - IsNotValid("DK0400", country); - IsNotValid("DK0569", country); - IsNotValid("DK0628", country); - IsNotValid("DK0761", country); - IsNotValid("DK0676", country); - IsNotValid("DK0875", country); - IsNotValid("DK0999", country); - - IsNotValid("AA0000", country); - IsNotValid("AS0144", country); - IsNotValid("BJ1282", country); - IsNotValid("CD2037", country); - IsNotValid("DE3243", country); - IsNotValid("EO4008", country); - IsNotValid("FN5697", country); - IsNotValid("GF6282", country); - IsNotValid("HL7611", country); - IsNotValid("ID6767", country); - IsNotValid("JS8752", country); - IsNotValid("KN9999", country); - IsNotValid("LO0000", country); - IsNotValid("ME0144", country); - IsNotValid("NN1282", country); - } - - /// Tests patterns that should not be valid for Algeria (DZ). - [Test] - public void IsNotValidCustomCases_DZ_All() - { - var country = Country.DZ; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Ecuador (EC). - [Test] - public void IsNotValidCustomCases_EC_All() - { - var country = Country.EC; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Estonia (EE). - [Test] - public void IsNotValidCustomCases_EE_All() - { - var country = Country.EE; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Egypt (EG). - [Test] - public void IsNotValidCustomCases_EG_All() - { - var country = Country.EG; - - IsNotValid("00000", country); - IsNotValid("01235", country); - } - - /// Tests patterns that should not be valid for Spain (ES). - [Test] - public void IsNotValidCustomCases_ES_All() - { - var country = Country.ES; - - IsNotValid("00000", country); - IsNotValid("53434", country); - IsNotValid("54082", country); - IsNotValid("55978", country); - IsNotValid("56824", country); - IsNotValid("57113", country); - IsNotValid("56671", country); - IsNotValid("58523", country); - IsNotValid("59999", country); - IsNotValid("62824", country); - IsNotValid("76113", country); - IsNotValid("67671", country); - IsNotValid("87523", country); - IsNotValid("99999", country); - } - - /// Tests patterns that should not be valid for Ethiopia (ET). - [Test] - public void IsNotValidCustomCases_ET_All() - { - var country = Country.ET; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Finland (FI). - [Test] - public void IsNotValidCustomCases_FI_All() - { - var country = Country.FI; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Falkland Islands (FK). - [Test] - public void IsNotValidCustomCases_FK_All() - { - var country = Country.FK; - - IsNotValid("FIAA1ZZ", country); - IsNotValid("FIAA9ZZ", country); - IsNotValid("DN551PT", country); - IsNotValid("DN551PT", country); - IsNotValid("EC1A1BB", country); - IsNotValid("EC1A1BB", country); - - } - - /// Tests patterns that should not be valid for Micronesia (FM). - [Test] - public void IsNotValidCustomCases_FM_All() - { - var country = Country.FM; - - IsNotValid("00000", country); - IsNotValid("01234", country); - IsNotValid("01449", country); - IsNotValid("12823", country); - IsNotValid("20375", country); - IsNotValid("32434", country); - IsNotValid("40082", country); - IsNotValid("56978", country); - IsNotValid("62824", country); - IsNotValid("76113", country); - IsNotValid("67671", country); - IsNotValid("87523", country); - IsNotValid("99999", country); - - IsNotValid("000000000", country); - IsNotValid("012345678", country); - IsNotValid("014494232", country); - IsNotValid("128235343", country); - IsNotValid("203757004", country); - IsNotValid("324343647", country); - IsNotValid("400827947", country); - IsNotValid("569783645", country); - IsNotValid("628246908", country); - IsNotValid("761134349", country); - IsNotValid("676718550", country); - IsNotValid("875239183", country); - IsNotValid("999999999", country); - } - - /// Tests patterns that should not be valid for Faroe Islands (FO). - [Test] - public void IsNotValidCustomCases_FO_All() - { - var country = Country.FO; - - IsNotValid("000", country); - IsNotValid("004", country); - IsNotValid("018", country); - IsNotValid("023", country); - IsNotValid("034", country); - IsNotValid("040", country); - IsNotValid("059", country); - IsNotValid("068", country); - IsNotValid("071", country); - IsNotValid("066", country); - IsNotValid("085", country); - IsNotValid("099", country); - - IsNotValid("FO000", country); - IsNotValid("FO004", country); - IsNotValid("FO018", country); - IsNotValid("FO023", country); - IsNotValid("FO034", country); - IsNotValid("FO040", country); - IsNotValid("FO059", country); - IsNotValid("FO068", country); - IsNotValid("FO071", country); - IsNotValid("FO066", country); - IsNotValid("FO085", country); - IsNotValid("FO099", country); - - IsNotValid("AA000", country); - IsNotValid("AS044", country); - IsNotValid("BJ182", country); - IsNotValid("CD237", country); - IsNotValid("DE343", country); - IsNotValid("EO408", country); - IsNotValid("FN597", country); - IsNotValid("GF682", country); - IsNotValid("HL711", country); - IsNotValid("ID667", country); - IsNotValid("JS852", country); - IsNotValid("KN999", country); - IsNotValid("LO000", country); - IsNotValid("ME044", country); - IsNotValid("NN182", country); - } - - /// Tests patterns that should not be valid for France (FR). - [Test] - public void IsNotValidCustomCases_FR_All() - { - var country = Country.FR; - - IsNotValid("00007", country); - IsNotValid("00043", country); - IsNotValid("00188", country); - IsNotValid("00237", country); - IsNotValid("00342", country); - IsNotValid("00401", country); - IsNotValid("00597", country); - IsNotValid("00682", country); - IsNotValid("00719", country); - IsNotValid("00665", country); - IsNotValid("00853", country); - IsNotValid("00999", country); - } - - /// Tests patterns that should not be valid for Gabon (GA). - [Test] - public void IsNotValidCustomCases_GA_All() - { - var country = Country.GA; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for United Kingdom (GB). - [Test] - public void IsNotValidCustomCases_GB_All() - { - var country = Country.GB; - - IsNotValid("311AA", country); - IsNotValid("M113A", country); - IsNotValid("M11A8", country); - IsNotValid("M1BAA", country); - - IsNotValid("1338TH", country); - IsNotValid("B338B9", country); - - IsNotValid("CRABXH", country); - IsNotValid("CR26X9", country); - - IsNotValid("DN55PPT", country); - IsNotValid("D1551PT", country); - - IsNotValid("WWA1HQ", country); - IsNotValid("W1A123", country); - - IsNotValid("EC1A112", country); - IsNotValid("EC1816B", country); - } - - /// Tests patterns that should not be valid for Georgia (GE). - [Test] - public void IsNotValidCustomCases_GE_All() - { - var country = Country.GE; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for French Guiana (GF). - [Test] - public void IsNotValidCustomCases_GF_All() - { - var country = Country.GF; - - IsNotValid("00000", country); - IsNotValid("01235", country); - IsNotValid("12346", country); - IsNotValid("20004", country); - IsNotValid("32648", country); - IsNotValid("40945", country); - IsNotValid("56640", country); - IsNotValid("62908", country); - IsNotValid("76345", country); - IsNotValid("67552", country); - IsNotValid("87182", country); - IsNotValid("99999", country); - - } - - /// Tests patterns that should not be valid for Guernsey (GG). - [Test] - public void IsNotValidCustomCases_GG_All() - { - var country = Country.GG; - - IsNotValid("336R", country); - IsNotValid("044W", country); - IsNotValid("678S", country); - IsNotValid("975P", country); - IsNotValid("650K", country); - IsNotValid("988L", country); - IsNotValid("395J", country); - - IsNotValid("5502M", country); - IsNotValid("1832D", country); - IsNotValid("9999J", country); - IsNotValid("0000D", country); - IsNotValid("2325D", country); - IsNotValid("3436R", country); - IsNotValid("0044W", country); - - IsNotValid("GG336R", country); - IsNotValid("GG044W", country); - IsNotValid("GG678S", country); - IsNotValid("GG975P", country); - IsNotValid("GG650K", country); - IsNotValid("GG988L", country); - IsNotValid("GG395J", country); - - IsNotValid("GG5502M", country); - IsNotValid("GG1832D", country); - IsNotValid("GG9999J", country); - IsNotValid("GG0000D", country); - IsNotValid("GG2325D", country); - IsNotValid("GG3436R", country); - IsNotValid("GG0044W", country); - - IsNotValid("GF88LS", country); - IsNotValid("HL95JD", country); - IsNotValid("ID02MO", country); - IsNotValid("JS32DF", country); - IsNotValid("KN99JS", country); - IsNotValid("LO00DF", country); - IsNotValid("ME25DS", country); - - IsNotValid("AA000DF", country); - IsNotValid("AS325DS", country); - IsNotValid("BJ436RF", country); - IsNotValid("CD044WK", country); - IsNotValid("DE478SD", country); - IsNotValid("EO475PJ", country); - IsNotValid("FN450KF", country); - } - - /// Tests patterns that should not be valid for Gibraltar (GI). - [Test] - public void IsNotValidCustomCases_GI_All() - { - var country = Country.GI; - - IsNotValid("DN123AA", country); - IsNotValid("GX123BB", country); - } - - /// Tests patterns that should not be valid for Greenland (GL). - [Test] - public void IsNotValidCustomCases_GL_All() - { - var country = Country.GL; - - IsNotValid("5502", country); - IsNotValid("1832", country); - IsNotValid("9999", country); - IsNotValid("0000", country); - IsNotValid("2325", country); - IsNotValid("3136", country); - IsNotValid("3236", country); - IsNotValid("3436", country); - IsNotValid("3436", country); - IsNotValid("3567", country); - IsNotValid("0044", country); - - IsNotValid("GL3365", country); - IsNotValid("GL0448", country); - IsNotValid("GL6789", country); - IsNotValid("GL9750", country); - IsNotValid("GL6503", country); - IsNotValid("GL9881", country); - IsNotValid("GL3852", country); - - IsNotValid("AA3900", country); - IsNotValid("AS3935", country); - IsNotValid("BJ3946", country); - IsNotValid("CD3904", country); - IsNotValid("DE3948", country); - IsNotValid("EO3945", country); - IsNotValid("FN3940", country); - } - - /// Tests patterns that should not be valid for Guadeloupe (GP). - [Test] - public void IsNotValidCustomCases_GP_All() - { - var country = Country.GP; - - IsNotValid("00000", country); - IsNotValid("01235", country); - IsNotValid("12346", country); - IsNotValid("20004", country); - IsNotValid("32648", country); - IsNotValid("40945", country); - IsNotValid("56640", country); - IsNotValid("62908", country); - IsNotValid("76345", country); - IsNotValid("67552", country); - IsNotValid("87182", country); - IsNotValid("99999", country); - } - - /// Tests patterns that should not be valid for Greece (GR). - [Test] - public void IsNotValidCustomCases_GR_All() - { - var country = Country.GR; - - IsNotValid("00072", country); - IsNotValid("00433", country); - IsNotValid("01885", country); - IsNotValid("02374", country); - IsNotValid("03421", country); - IsNotValid("04014", country); - IsNotValid("05957", country); - IsNotValid("06862", country); - IsNotValid("07159", country); - IsNotValid("06685", country); - IsNotValid("08593", country); - IsNotValid("09999", country); - } - - /// Tests patterns that should not be valid for South Georgia And The South Sandwich Islands (GS). - [Test] - public void IsNotValidCustomCases_GS_All() - { - var country = Country.GS; - - IsNotValid("SIQQ1AZ", country); - IsNotValid("SIQQ9ZZ", country); - IsNotValid("SIBB1ZZ", country); - IsNotValid("DN551PT", country); - IsNotValid("DN551PT", country); - IsNotValid("EC1A1BB", country); - IsNotValid("EC1A1BB", country); - } - - /// Tests patterns that should not be valid for Guatemala (GT). - [Test] - public void IsNotValidCustomCases_GT_All() - { - var country = Country.GT; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Guam (GU). - [Test] - public void IsNotValidCustomCases_GU_All() - { - var country = Country.GU; - - IsNotValid("00000", country); - IsNotValid("01235", country); - IsNotValid("12346", country); - IsNotValid("20004", country); - IsNotValid("32648", country); - IsNotValid("40945", country); - IsNotValid("56640", country); - IsNotValid("62908", country); - IsNotValid("76345", country); - IsNotValid("67552", country); - IsNotValid("87182", country); - IsNotValid("96908", country); - IsNotValid("96938", country); - IsNotValid("99999", country); - - IsNotValid("000000000", country); - IsNotValid("012301235", country); - IsNotValid("123412346", country); - IsNotValid("200020004", country); - IsNotValid("326432648", country); - IsNotValid("409440945", country); - IsNotValid("566456640", country); - IsNotValid("629062908", country); - IsNotValid("763476345", country); - IsNotValid("675567552", country); - IsNotValid("871887182", country); - IsNotValid("969087182", country); - IsNotValid("969387182", country); - IsNotValid("999999999", country); - } - - /// Tests patterns that should not be valid for Guinea-Bissau (GW). - [Test] - public void IsNotValidCustomCases_GW_All() - { - var country = Country.GW; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Heard Island And Mcdonald Islands (HM). - [Test] - public void IsNotValidCustomCases_HM_All() - { - var country = Country.HM; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Honduras (HN). - [Test] - public void IsNotValidCustomCases_HN_All() - { - var country = Country.HN; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Croatia (HR). - [Test] - public void IsNotValidCustomCases_HR_All() - { - var country = Country.HR; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Haiti (HT). - [Test] - public void IsNotValidCustomCases_HT_All() - { - var country = Country.HT; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Hungary (HU). - [Test] - public void IsNotValidCustomCases_HU_All() - { - var country = Country.HU; - - IsNotValid("0007", country); - IsNotValid("0043", country); - IsNotValid("0188", country); - IsNotValid("0237", country); - IsNotValid("0342", country); - IsNotValid("0401", country); - IsNotValid("0595", country); - IsNotValid("0686", country); - IsNotValid("0715", country); - IsNotValid("0668", country); - IsNotValid("0859", country); - IsNotValid("0999", country); - } - - /// Tests patterns that should not be valid for Indonesia (ID). - [Test] - public void IsNotValidCustomCases_ID_All() - { - var country = Country.ID; - - IsNotValid("00072", country); - IsNotValid("00433", country); - IsNotValid("01885", country); - IsNotValid("02374", country); - IsNotValid("03421", country); - IsNotValid("04014", country); - IsNotValid("05957", country); - IsNotValid("06862", country); - IsNotValid("07159", country); - IsNotValid("06685", country); - IsNotValid("08593", country); - IsNotValid("09999", country); - } - - /// Tests patterns that should not be valid for Israel (IL). - [Test] - public void IsNotValidCustomCases_IL_All() - { - var country = Country.IL; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Isle Of Man (IM). - [Test] - public void IsNotValidCustomCases_IM_All() - { - var country = Country.IM; - - IsNotValid("IMAA00DF", country); - IsNotValid("IMAS04DS", country); - IsNotValid("IMBJ18RF", country); - IsNotValid("IMCD23WK", country); - IsNotValid("IMDE34SD", country); - IsNotValid("IMEO40PJ", country); - IsNotValid("IMFN59KF", country); - IsNotValid("IMGF68LS", country); - IsNotValid("IMHL71JD", country); - IsNotValid("IMID66MO", country); - IsNotValid("IMJS85DF", country); - IsNotValid("IMKN99JS", country); - IsNotValid("IMLO00DF", country); - - IsNotValid("AA000DF", country); - IsNotValid("AS014DS", country); - IsNotValid("BJ128RF", country); - IsNotValid("CD203WK", country); - IsNotValid("DE324SD", country); - IsNotValid("EO400PJ", country); - IsNotValid("FN569KF", country); - IsNotValid("GF628LS", country); - IsNotValid("HL761JD", country); - IsNotValid("ID676MO", country); - IsNotValid("JS875DF", country); - IsNotValid("KN999JS", country); - IsNotValid("LO000DF", country); - } - - /// Tests patterns that should not be valid for India (IN). - [Test] - public void IsNotValidCustomCases_IN_All() - { - var country = Country.IN; - - IsNotValid("00000", country); - IsNotValid("00149", country); - IsNotValid("01283", country); - IsNotValid("02035", country); - IsNotValid("03244", country); - IsNotValid("04002", country); - IsNotValid("05698", country); - IsNotValid("06284", country); - IsNotValid("07613", country); - IsNotValid("06761", country); - IsNotValid("08753", country); - IsNotValid("09999", country); - } - - /// Tests patterns that should not be valid for British Indian Ocean Territory (IO). - [Test] - public void IsNotValidCustomCases_IO_All() - { - var country = Country.IO; - - IsNotValid("AADF0DF", country); - IsNotValid("ASDS0DS", country); - IsNotValid("BJRF1RF", country); - IsNotValid("CDWK2WK", country); - IsNotValid("DESD3SD", country); - IsNotValid("EOPJ4PJ", country); - IsNotValid("FNKF5KF", country); - IsNotValid("GFLS6LS", country); - IsNotValid("HLJD7JD", country); - IsNotValid("IDMO6MO", country); - IsNotValid("JSDF8DF", country); - IsNotValid("KNJS9JS", country); - } - - /// Tests patterns that should not be valid for Iraq (IQ). - [Test] - public void IsNotValidCustomCases_IQ_All() - { - var country = Country.IQ; - - IsNotValid("00000", country); - IsNotValid("20004", country); - IsNotValid("76345", country); - IsNotValid("87182", country); - IsNotValid("99999", country); - } - - /// Tests patterns that should not be valid for Iran (IR). - [Test] - public void IsNotValidCustomCases_IR_All() - { - var country = Country.IR; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Iceland (IS). - [Test] - public void IsNotValidCustomCases_IS_All() - { - var country = Country.IS; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Italy (IT). - [Test] - public void IsNotValidCustomCases_IT_All() - { - var country = Country.IT; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Jersey (JE). - [Test] - public void IsNotValidCustomCases_JE_All() - { - var country = Country.JE; - - IsNotValid("0", country); - - IsNotValid("A00S", country); - IsNotValid("G25S", country); - IsNotValid("D36F", country); - IsNotValid("D44S", country); - IsNotValid("R78F", country); - IsNotValid("W75K", country); - IsNotValid("5D0S", country); - IsNotValid("8J8P", country); - IsNotValid("9F5K", country); - IsNotValid("0LS2", country); - IsNotValid("3JD2", country); - IsNotValid("9MO9", country); - IsNotValid("0AS0", country); - IsNotValid("G042S", country); - IsNotValid("D153F", country); - IsNotValid("D274S", country); - IsNotValid("3R37F", country); - IsNotValid("4W77K", country); - IsNotValid("5S35D", country); - IsNotValid("66PJ8", country); - IsNotValid("74KF9", country); - IsNotValid("6S80L", country); - IsNotValid("8D93J", country); - IsNotValid("9O99M", country); - } - - /// Tests patterns that should not be valid for Jordan (JO). - [Test] - public void IsNotValidCustomCases_JO_All() - { - var country = Country.JO; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Japan (JP). - [Test] - public void IsNotValidCustomCases_JP_All() - { - var country = Country.JP; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Kyrgyzstan (KG). - [Test] - public void IsNotValidCustomCases_KG_All() - { - var country = Country.KG; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Cambodia (KH). - [Test] - public void IsNotValidCustomCases_KH_All() - { - var country = Country.KH; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Korea (KR). - [Test] - public void IsNotValidCustomCases_KR_All() - { - var country = Country.KR; - - IsNotValid("000000", country); - IsNotValid("023456", country); - IsNotValid("012823", country); - IsNotValid("020375", country); - IsNotValid("032434", country); - IsNotValid("040082", country); - IsNotValid("056978", country); - IsNotValid("862824", country); - IsNotValid("861134", country); - IsNotValid("876718", country); - IsNotValid("975239", country); - IsNotValid("999999", country); - } - - /// Tests patterns that should not be valid for Cayman Islands (KY). - [Test] - public void IsNotValidCustomCases_KY_All() - { - var country = Country.KY; - - IsNotValid("AA00000", country); - IsNotValid("AS01449", country); - IsNotValid("BJ12823", country); - IsNotValid("CD20375", country); - IsNotValid("DE32434", country); - IsNotValid("EO40082", country); - IsNotValid("FN56978", country); - IsNotValid("GF62824", country); - IsNotValid("HL76113", country); - IsNotValid("ID67671", country); - IsNotValid("JS87523", country); - IsNotValid("KN99999", country); - IsNotValid("LO00000", country); - IsNotValid("ME01449", country); - IsNotValid("NN12823", country); - IsNotValid("OL20375", country); - IsNotValid("PS32434", country); - IsNotValid("QD40082", country); - IsNotValid("RN56978", country); - IsNotValid("SE62824", country); - IsNotValid("TM76113", country); - IsNotValid("UF67671", country); - IsNotValid("VE87523", country); - IsNotValid("WL99999", country); - IsNotValid("XM00000", country); - IsNotValid("YE01449", country); - IsNotValid("ZL12823", country); - IsNotValid("ZZ20375", country); - } - - /// Tests patterns that should not be valid for Kazakhstan (KZ). - [Test] - public void IsNotValidCustomCases_KZ_All() - { - var country = Country.KZ; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Lao People'S Democratic Republic (LA). - [Test] - public void IsNotValidCustomCases_LA_All() - { - var country = Country.LA; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Lebanon (LB). - [Test] - public void IsNotValidCustomCases_LB_All() - { - var country = Country.LB; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Liechtenstein (LI). - [Test] - public void IsNotValidCustomCases_LI_All() - { - var country = Country.LI; - - IsNotValid("0000", country); - IsNotValid("0144", country); - IsNotValid("1282", country); - IsNotValid("2037", country); - IsNotValid("3243", country); - IsNotValid("4008", country); - IsNotValid("5697", country); - IsNotValid("6282", country); - IsNotValid("7611", country); - IsNotValid("6767", country); - IsNotValid("8752", country); - IsNotValid("9999", country); - - IsNotValid("9300", country); - IsNotValid("9499", country); - IsNotValid("9593", country); - IsNotValid("9679", country); - IsNotValid("9480", country); - IsNotValid("9481", country); - IsNotValid("9482", country); - IsNotValid("9483", country); - IsNotValid("9484", country); - IsNotValid("9499", country); - } - - /// Tests patterns that should not be valid for Sri Lanka (LK). - [Test] - public void IsNotValidCustomCases_LK_All() - { - var country = Country.LK; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Liberia (LR). - [Test] - public void IsNotValidCustomCases_LR_All() - { - var country = Country.LR; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Lesotho (LS). - [Test] - public void IsNotValidCustomCases_LS_All() - { - var country = Country.LS; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Lithuania (LT). - [Test] - public void IsNotValidCustomCases_LT_All() - { - var country = Country.LT; - - IsNotValid("AA00000", country); - IsNotValid("AS01449", country); - IsNotValid("BJ12823", country); - IsNotValid("CD20375", country); - IsNotValid("DE32434", country); - IsNotValid("EO40082", country); - IsNotValid("FN56978", country); - IsNotValid("GF62824", country); - IsNotValid("HL76113", country); - IsNotValid("ID67671", country); - IsNotValid("JS87523", country); - IsNotValid("KN99999", country); - IsNotValid("LO00000", country); - IsNotValid("ME01449", country); - IsNotValid("NN12823", country); - IsNotValid("OL20375", country); - IsNotValid("PS32434", country); - IsNotValid("QD40082", country); - IsNotValid("RN56978", country); - IsNotValid("SE62824", country); - IsNotValid("TM76113", country); - IsNotValid("UF67671", country); - IsNotValid("VE87523", country); - IsNotValid("WL99999", country); - IsNotValid("XM00000", country); - IsNotValid("YE01449", country); - IsNotValid("ZL12823", country); - IsNotValid("ZZ20375", country); - } - - /// Tests patterns that should not be valid for Luxembourg (LU). - [Test] - public void IsNotValidCustomCases_LU_All() - { - var country = Country.LU; - - IsNotValid("AA0000", country); - IsNotValid("AS0144", country); - IsNotValid("BJ1282", country); - IsNotValid("CD2037", country); - IsNotValid("DE3243", country); - IsNotValid("EO4008", country); - IsNotValid("FN5697", country); - IsNotValid("GF6282", country); - IsNotValid("HL7611", country); - IsNotValid("ID6767", country); - IsNotValid("JS8752", country); - IsNotValid("KN9999", country); - IsNotValid("LO0000", country); - IsNotValid("ME0144", country); - IsNotValid("NN1282", country); - IsNotValid("OL2037", country); - IsNotValid("PS3243", country); - } - - /// Tests patterns that should not be valid for Latvia (LV). - [Test] - public void IsNotValidCustomCases_LV_All() - { - var country = Country.KY; - - IsNotValid("AA0000", country); - IsNotValid("AS0449", country); - IsNotValid("BJ1823", country); - IsNotValid("CD2375", country); - IsNotValid("DE3434", country); - IsNotValid("EO4082", country); - IsNotValid("FN5978", country); - IsNotValid("GF6824", country); - IsNotValid("HL7113", country); - IsNotValid("ID6671", country); - IsNotValid("JS8523", country); - IsNotValid("KN9999", country); - IsNotValid("LO0000", country); - IsNotValid("ME0449", country); - IsNotValid("NN1823", country); - IsNotValid("OL2375", country); - IsNotValid("PS3434", country); - IsNotValid("QD4082", country); - IsNotValid("RN5978", country); - IsNotValid("SE6824", country); - IsNotValid("TM7113", country); - IsNotValid("UF6671", country); - IsNotValid("VE8523", country); - IsNotValid("WL9999", country); - IsNotValid("XM0000", country); - IsNotValid("YE0449", country); - IsNotValid("ZL1823", country); - IsNotValid("ZZ2375", country); - } - - /// Tests patterns that should not be valid for Libya (LY). - [Test] - public void IsNotValidCustomCases_LY_All() - { - var country = Country.LY; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Morocco (MA). - [Test] - public void IsNotValidCustomCases_MA_All() - { - var country = Country.MA; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Monaco (MC). - [Test] - public void IsNotValidCustomCases_MC_All() - { - var country = Country.MC; - - IsNotValid("00000", country); - IsNotValid("04249", country); - IsNotValid("18323", country); - IsNotValid("23475", country); - IsNotValid("34734", country); - IsNotValid("40782", country); - IsNotValid("59578", country); - IsNotValid("68824", country); - IsNotValid("71913", country); - IsNotValid("66071", country); - IsNotValid("98123", country); - IsNotValid("98299", country); - IsNotValid("98344", country); - IsNotValid("98402", country); - IsNotValid("98598", country); - IsNotValid("98684", country); - IsNotValid("98713", country); - IsNotValid("98661", country); - IsNotValid("98983", country); - IsNotValid("98989", country); - IsNotValid("00000", country); - - IsNotValid("MC00000", country); - IsNotValid("MC04249", country); - IsNotValid("MC18323", country); - IsNotValid("MC23475", country); - IsNotValid("MC34734", country); - IsNotValid("MC40782", country); - IsNotValid("MC59578", country); - IsNotValid("MC68824", country); - IsNotValid("MC71913", country); - IsNotValid("MC66071", country); - IsNotValid("MC85323", country); - IsNotValid("MC99999", country); - IsNotValid("MC00000", country); - - IsNotValid("AA98000", country); - IsNotValid("AS98049", country); - IsNotValid("BJ98023", country); - IsNotValid("CD98075", country); - IsNotValid("DE98034", country); - IsNotValid("EO98082", country); - IsNotValid("FN98078", country); - IsNotValid("GF98024", country); - IsNotValid("HL98013", country); - IsNotValid("ID98071", country); - IsNotValid("JS98023", country); - IsNotValid("KN98099", country); - IsNotValid("LO98000", country); - IsNotValid("ME98049", country); - IsNotValid("NN98023", country); - IsNotValid("OL98075", country); - IsNotValid("PS98034", country); - IsNotValid("QD98082", country); - IsNotValid("RN98078", country); - IsNotValid("SE98024", country); - IsNotValid("TM98013", country); - IsNotValid("UF98071", country); - IsNotValid("VE98023", country); - IsNotValid("WL98099", country); - IsNotValid("XM98000", country); - IsNotValid("YE98049", country); - IsNotValid("ZL98023", country); - IsNotValid("ZZ98075", country); - } - - /// Tests patterns that should not be valid for Moldova (MD). - [Test] - public void IsNotValidCustomCases_MD_All() - { - var country = Country.MD; - - IsNotValid("AA0000", country); - IsNotValid("AS0144", country); - IsNotValid("BJ1282", country); - IsNotValid("CD2037", country); - IsNotValid("DE3243", country); - IsNotValid("EO4008", country); - IsNotValid("FN5697", country); - IsNotValid("GF6282", country); - IsNotValid("HL7611", country); - IsNotValid("ID6767", country); - IsNotValid("JS8752", country); - IsNotValid("KN9999", country); - IsNotValid("LO0000", country); - IsNotValid("ME0144", country); - IsNotValid("NN1282", country); - IsNotValid("OL2037", country); - IsNotValid("PS3243", country); - } - - /// Tests patterns that should not be valid for Montenegro (ME). - [Test] - public void IsNotValidCustomCases_ME_All() - { - var country = Country.MD; - - IsNotValid("00000", country); - IsNotValid("01449", country); - IsNotValid("12823", country); - IsNotValid("20375", country); - IsNotValid("32434", country); - IsNotValid("40082", country); - IsNotValid("56978", country); - IsNotValid("62824", country); - IsNotValid("76113", country); - IsNotValid("67671", country); - IsNotValid("87523", country); - IsNotValid("99999", country); - - IsNotValid("80000", country); - IsNotValid("80149", country); - IsNotValid("82035", country); - IsNotValid("83244", country); - IsNotValid("86284", country); - IsNotValid("87613", country); - IsNotValid("86761", country); - IsNotValid("88753", country); - IsNotValid("89999", country); - } - - /// Tests patterns that should not be valid for Saint Martin (MF). - [Test] - public void IsNotValidCustomCases_MF_All() - { - var country = Country.MF; - - IsNotValid("00000", country); - IsNotValid("01235", country); - IsNotValid("12346", country); - IsNotValid("20004", country); - IsNotValid("32648", country); - IsNotValid("40945", country); - IsNotValid("56640", country); - IsNotValid("62908", country); - IsNotValid("76345", country); - IsNotValid("67552", country); - IsNotValid("87182", country); - IsNotValid("99999", country); - } - - /// Tests patterns that should not be valid for Madagascar (MG). - [Test] - public void IsNotValidCustomCases_MG_All() - { - var country = Country.MG; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Marshall Islands (MH). - [Test] - public void IsNotValidCustomCases_MH_All() - { - var country = Country.MH; - - IsNotValid("06000", country); - IsNotValid("00425", country); - IsNotValid("11836", country); - IsNotValid("22304", country); - IsNotValid("33468", country); - IsNotValid("44095", country); - IsNotValid("55960", country); - IsNotValid("66898", country); - IsNotValid("77135", country); - IsNotValid("66652", country); - IsNotValid("88512", country); - IsNotValid("99999", country); - IsNotValid("96932", country); - IsNotValid("96951", country); - IsNotValid("96989", country); - IsNotValid("00000", country); - - IsNotValid("000000000", country); - IsNotValid("012345678", country); - IsNotValid("128253436", country); - IsNotValid("203770044", country); - IsNotValid("324336478", country); - IsNotValid("400879475", country); - IsNotValid("569736450", country); - IsNotValid("628269088", country); - IsNotValid("761143495", country); - IsNotValid("676785502", country); - IsNotValid("875291832", country); - IsNotValid("999999999", country); - IsNotValid("000000000", country); - } - - /// Tests patterns that should not be valid for Macedonia (MK). - [Test] - public void IsNotValidCustomCases_MK_All() - { - var country = Country.MK; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Myanmar (MM). - [Test] - public void IsNotValidCustomCases_MM_All() - { - var country = Country.MM; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Mongolia (MN). - [Test] - public void IsNotValidCustomCases_MN_All() - { - var country = Country.MN; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Northern Mariana Islands (MP). - [Test] - public void IsNotValidCustomCases_MP_All() - { - var country = Country.MP; - - IsNotValid("00000", country); - IsNotValid("01235", country); - IsNotValid("12346", country); - IsNotValid("20004", country); - IsNotValid("32648", country); - IsNotValid("40945", country); - IsNotValid("56640", country); - IsNotValid("62908", country); - IsNotValid("76345", country); - IsNotValid("67552", country); - IsNotValid("87182", country); - IsNotValid("99999", country); - IsNotValid("96949", country); - IsNotValid("96953", country); - IsNotValid("96954", country); - IsNotValid("000000000", country); - IsNotValid("012354423", country); - IsNotValid("123462534", country); - IsNotValid("200047700", country); - IsNotValid("326483364", country); - IsNotValid("409458794", country); - IsNotValid("566407364", country); - IsNotValid("629082690", country); - IsNotValid("763451434", country); - IsNotValid("675527855", country); - IsNotValid("871822918", country); - IsNotValid("969496831", country); - IsNotValid("969535348", country); - IsNotValid("969545607", country); - IsNotValid("999999999", country); - } - - /// Tests patterns that should not be valid for Martinique (MQ). - [Test] - public void IsNotValidCustomCases_MQ_All() - { - var country = Country.MQ; - - IsNotValid("00000", country); - IsNotValid("01235", country); - IsNotValid("12346", country); - IsNotValid("20004", country); - IsNotValid("32648", country); - IsNotValid("40945", country); - IsNotValid("56640", country); - IsNotValid("62908", country); - IsNotValid("76345", country); - IsNotValid("67552", country); - IsNotValid("87182", country); - IsNotValid("99999", country); - } - - /// Tests patterns that should not be valid for Malta (MT). - [Test] - public void IsNotValidCustomCases_MT_All() - { - var country = Country.MT; - - IsNotValid("AA00000", country); - IsNotValid("ASD01D2", country); - } - - /// Tests patterns that should not be valid for Mexico (MX). - [Test] - public void IsNotValidCustomCases_MX_All() - { - var country = Country.MX; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Malaysia (MY). - [Test] - public void IsNotValidCustomCases_MY_All() - { - var country = Country.MY; - - IsNotValid("00000", country); - IsNotValid("00035", country); - IsNotValid("00146", country); - IsNotValid("00204", country); - IsNotValid("00348", country); - IsNotValid("00445", country); - IsNotValid("00540", country); - IsNotValid("00608", country); - IsNotValid("00745", country); - IsNotValid("00652", country); - IsNotValid("00882", country); - IsNotValid("00999", country); - } - - /// Tests patterns that should not be valid for Mozambique (MZ). - [Test] - public void IsNotValidCustomCases_MZ_All() - { - var country = Country.MZ; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Namibia (NA). - [Test] - public void IsNotValidCustomCases_NA_All() - { - var country = Country.NA; - - IsNotValid("00000", country); - IsNotValid("01235", country); - IsNotValid("12346", country); - IsNotValid("20004", country); - IsNotValid("32648", country); - IsNotValid("40945", country); - IsNotValid("56640", country); - IsNotValid("62908", country); - IsNotValid("76345", country); - IsNotValid("67552", country); - IsNotValid("87182", country); - IsNotValid("89999", country); - IsNotValid("93000", country); - IsNotValid("99999", country); - } - - /// Tests patterns that should not be valid for New Caledonia (NC). - [Test] - public void IsNotValidCustomCases_NC_All() - { - var country = Country.NC; - - IsNotValid("00000", country); - IsNotValid("01235", country); - IsNotValid("12346", country); - IsNotValid("20004", country); - IsNotValid("32648", country); - IsNotValid("40945", country); - IsNotValid("56640", country); - IsNotValid("62908", country); - IsNotValid("76345", country); - IsNotValid("67552", country); - IsNotValid("87182", country); - IsNotValid("99999", country); - - IsNotValid("98600", country); - IsNotValid("98535", country); - IsNotValid("98346", country); - IsNotValid("98204", country); - IsNotValid("98648", country); - IsNotValid("98545", country); - IsNotValid("98140", country); - IsNotValid("98108", country); - IsNotValid("99045", country); - IsNotValid("99052", country); - IsNotValid("97982", country); - IsNotValid("99999", country); - } - - /// Tests patterns that should not be valid for Niger (NE). - [Test] - public void IsNotValidCustomCases_NE_All() - { - var country = Country.NE; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Norfolk Island (NF). - [Test] - public void IsNotValidCustomCases_NF_All() - { - var country = Country.NF; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Nigeria (NG). - [Test] - public void IsNotValidCustomCases_NG_All() - { - var country = Country.NG; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Nicaragua (NI). - [Test] - public void IsNotValidCustomCases_NI_All() - { - var country = Country.NI; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Netherlands (NL). - [Test] - public void IsNotValidCustomCases_NL_All() - { - var country = Country.NL; - - IsNotValid("0000DF", country); - IsNotValid("0125DS", country); - IsNotValid("3278SA", country); - IsNotValid("8732SD", country); - IsNotValid("9999SS", country); - } - - /// Tests patterns that should not be valid for Norway (NO). - [Test] - public void IsNotValidCustomCases_NO_All() - { - var country = Country.NO; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Nepal (NP). - [Test] - public void IsNotValidCustomCases_NP_All() - { - var country = Country.NP; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for New Zealand (NZ). - [Test] - public void IsNotValidCustomCases_NZ_All() - { - var country = Country.NZ; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Oman (OM). - [Test] - public void IsNotValidCustomCases_OM_All() - { - var country = Country.OM; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Panama (PA). - [Test] - public void IsNotValidCustomCases_PA_All() - { - var country = Country.PA; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Peru (PE). - [Test] - public void IsNotValidCustomCases_PE_All() - { - var country = Country.PE; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for French Polynesia (PF). - [Test] - public void IsNotValidCustomCases_PF_All() - { - var country = Country.PF; - - IsNotValid("00000", country); - IsNotValid("01235", country); - IsNotValid("12346", country); - IsNotValid("20004", country); - IsNotValid("32648", country); - IsNotValid("40945", country); - IsNotValid("56640", country); - IsNotValid("62908", country); - IsNotValid("76345", country); - IsNotValid("67552", country); - IsNotValid("87182", country); - IsNotValid("98524", country); - IsNotValid("98600", country); - IsNotValid("98805", country); - IsNotValid("98916", country); - IsNotValid("99999", country); - } - - /// Tests patterns that should not be valid for Papua New Guinea (PG). - [Test] - public void IsNotValidCustomCases_PG_All() - { - var country = Country.PG; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Philippines (PH). - [Test] - public void IsNotValidCustomCases_PH_All() - { - var country = Country.PH; - - IsNotValid("0000", country); - IsNotValid("0003", country); - IsNotValid("0014", country); - IsNotValid("0020", country); - IsNotValid("0034", country); - IsNotValid("0044", country); - IsNotValid("0054", country); - IsNotValid("0060", country); - IsNotValid("0074", country); - IsNotValid("0065", country); - IsNotValid("0088", country); - IsNotValid("0099", country); - } - - /// Tests patterns that should not be valid for Pakistan (PK). - [Test] - public void IsNotValidCustomCases_PK_All() - { - var country = Country.PK; - - IsNotValid("00000", country); - IsNotValid("00125", country); - IsNotValid("01236", country); - IsNotValid("02004", country); - IsNotValid("03268", country); - IsNotValid("04095", country); - IsNotValid("05660", country); - IsNotValid("06298", country); - IsNotValid("07635", country); - IsNotValid("06752", country); - IsNotValid("08712", country); - IsNotValid("09854", country); - IsNotValid("09860", country); - IsNotValid("09885", country); - IsNotValid("09896", country); - IsNotValid("09999", country); - } - - /// Tests patterns that should not be valid for Poland (PL). - [Test] - public void IsNotValidCustomCases_PL_All() - { - var country = Country.PL; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Saint Pierre And Miquelon (PM). - [Test] - public void IsNotValidCustomCases_PM_All() - { - var country = Country.PM; - - IsNotValid("00000", country); - IsNotValid("01235", country); - IsNotValid("12346", country); - IsNotValid("20004", country); - IsNotValid("32648", country); - IsNotValid("40945", country); - IsNotValid("56640", country); - IsNotValid("62908", country); - IsNotValid("76345", country); - IsNotValid("67552", country); - IsNotValid("87182", country); - IsNotValid("97000", country); - IsNotValid("97101", country); - IsNotValid("97212", country); - IsNotValid("97320", country); - IsNotValid("97432", country); - IsNotValid("97640", country); - IsNotValid("97756", country); - IsNotValid("97862", country); - IsNotValid("97976", country); - IsNotValid("99999", country); - IsNotValid("97502", country); - IsNotValid("97513", country); - IsNotValid("97520", country); - IsNotValid("97536", country); - IsNotValid("97549", country); - IsNotValid("97556", country); - IsNotValid("97569", country); - IsNotValid("97573", country); - IsNotValid("97565", country); - IsNotValid("97581", country); - IsNotValid("97599", country); - } - - /// Tests patterns that should not be valid for Pitcairn (PN). - [Test] - public void IsNotValidCustomCases_PN_All() - { - var country = Country.PN; - - IsNotValid("PCRN2ZZ", country); - IsNotValid("AADF0FD", country); - IsNotValid("ASDS0KD", country); - IsNotValid("BJRF1DR", country); - IsNotValid("CDWK2JW", country); - IsNotValid("DESD3FS", country); - IsNotValid("EOPJ4SP", country); - IsNotValid("FNKF5DK", country); - IsNotValid("GFLS6OL", country); - IsNotValid("HLJD7FJ", country); - IsNotValid("IDMO6SM", country); - IsNotValid("JSDF8FD", country); - IsNotValid("KNJS9SJ", country); - IsNotValid("LODF0FD", country); - IsNotValid("MEDS0KD", country); - IsNotValid("NNRF1RF", country); - IsNotValid("OLWK2WS", country); - IsNotValid("PSSD3SF", country); - IsNotValid("QDPJ4PK", country); - IsNotValid("RNKF5KD", country); - IsNotValid("SELS6LJ", country); - IsNotValid("TMJD7JF", country); - IsNotValid("UFMO6MS", country); - IsNotValid("VEDF8DD", country); - IsNotValid("WLJS9JO", country); - IsNotValid("XMDF0DF", country); - IsNotValid("YEDS0DS", country); - IsNotValid("ZLRF1RF", country); - IsNotValid("ZZWK2WS", country); - } - - /// Tests patterns that should not be valid for Puerto Rico (PR). - [Test] - public void IsNotValidCustomCases_PR_All() - { - var country = Country.PR; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Palestinian Territory (PS). - [Test] - public void IsNotValidCustomCases_PS_All() - { - var country = Country.PS; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Portugal (PT). - [Test] - public void IsNotValidCustomCases_PT_All() - { - var country = Country.PT; - - IsNotValid("0000000", country); - IsNotValid("0014494", country); - IsNotValid("0123456", country); - IsNotValid("0203757", country); - IsNotValid("0324343", country); - IsNotValid("0400827", country); - IsNotValid("0569783", country); - IsNotValid("0628246", country); - IsNotValid("0761134", country); - IsNotValid("0676718", country); - IsNotValid("0875239", country); - IsNotValid("0999999", country); - } - - /// Tests patterns that should not be valid for Palau (PW). - [Test] - public void IsNotValidCustomCases_PW_All() - { - var country = Country.PW; - - IsNotValid("01235", country); - IsNotValid("12346", country); - IsNotValid("20004", country); - IsNotValid("32648", country); - IsNotValid("40945", country); - IsNotValid("56640", country); - IsNotValid("62908", country); - IsNotValid("76345", country); - IsNotValid("67552", country); - IsNotValid("87182", country); - IsNotValid("96939", country); - IsNotValid("96941", country); - IsNotValid("96948", country); - IsNotValid("96952", country); - IsNotValid("99999", country); - } - - /// Tests patterns that should not be valid for Paraguay (PY). - [Test] - public void IsNotValidCustomCases_PY_All() - { - var country = Country.PY; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Réunion (RE). - [Test] - public void IsNotValidCustomCases_RE_All() - { - var country = Country.RE; - - IsNotValid("00000", country); - IsNotValid("01235", country); - IsNotValid("12346", country); - IsNotValid("20004", country); - IsNotValid("32648", country); - IsNotValid("40945", country); - IsNotValid("56640", country); - IsNotValid("62908", country); - IsNotValid("76345", country); - IsNotValid("67552", country); - IsNotValid("87182", country); - IsNotValid("97000", country); - IsNotValid("97102", country); - IsNotValid("97213", country); - IsNotValid("97320", country); - IsNotValid("97536", country); - IsNotValid("97649", country); - IsNotValid("97756", country); - IsNotValid("97869", country); - IsNotValid("97973", country); - IsNotValid("99999", country); - } - - /// Tests patterns that should not be valid for Romania (RO). - [Test] - public void IsNotValidCustomCases_RO_All() - { - var country = Country.RO; - - IsNotValid("00000", country); - IsNotValid("00012", country); - IsNotValid("00123", country); - IsNotValid("00200", country); - IsNotValid("00326", country); - IsNotValid("00409", country); - IsNotValid("00566", country); - IsNotValid("00629", country); - IsNotValid("00763", country); - IsNotValid("00675", country); - IsNotValid("00871", country); - IsNotValid("00970", country); - IsNotValid("00999", country); - } - - /// Tests patterns that should not be valid for Serbia (RS). - [Test] - public void IsNotValidCustomCases_RS_All() - { - var country = Country.RS; - - IsNotValid("000000", country); - IsNotValid("012345", country); - IsNotValid("400827", country); - IsNotValid("569783", country); - IsNotValid("628246", country); - IsNotValid("761134", country); - IsNotValid("676718", country); - IsNotValid("875239", country); - IsNotValid("999999", country); - } - - /// Tests patterns that should not be valid for Russian Federation (RU). - [Test] - public void IsNotValidCustomCases_RU_All() - { - var country = Country.RU; - - IsNotValid("0000000", country); - IsNotValid("0012345", country); - IsNotValid("0128235", country); - IsNotValid("0203757", country); - IsNotValid("0324343", country); - IsNotValid("0400827", country); - IsNotValid("0569783", country); - IsNotValid("0628246", country); - IsNotValid("0761134", country); - IsNotValid("0676718", country); - IsNotValid("0875239", country); - IsNotValid("0999999", country); - } - - /// Tests patterns that should not be valid for Saudi Arabia (SA). - [Test] - public void IsNotValidCustomCases_SA_All() - { - var country = Country.SA; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Sudan (SD). - [Test] - public void IsNotValidCustomCases_SD_All() - { - var country = Country.SD; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Sweden (SE). - [Test] - public void IsNotValidCustomCases_SE_All() - { - var country = Country.SE; - - IsNotValid("000000", country); - IsNotValid("001235", country); - IsNotValid("012825", country); - IsNotValid("020377", country); - IsNotValid("032433", country); - IsNotValid("040087", country); - IsNotValid("056973", country); - IsNotValid("062826", country); - IsNotValid("076114", country); - IsNotValid("067678", country); - IsNotValid("087529", country); - IsNotValid("099999", country); - } - - /// Tests patterns that should not be valid for Singapore (SG). - [Test] - public void IsNotValidCustomCases_SG_All() - { - var country = Country.SG; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Saint Helena (SH). - [Test] - public void IsNotValidCustomCases_SH_All() - { - var country = Country.SH; - - IsNotValid("SAHL1ZZ", country); - IsNotValid("STBL1AZ", country); - IsNotValid("STHL2ZZ", country); - IsNotValid("AADF0DF", country); - IsNotValid("ASDS2DS", country); - IsNotValid("BJRF3RF", country); - IsNotValid("CDWK4WK", country); - IsNotValid("DESD7SD", country); - IsNotValid("EOPJ7PJ", country); - IsNotValid("FNKF5KF", country); - IsNotValid("GFLS8LS", country); - IsNotValid("HLJD9JD", country); - IsNotValid("IDMO0MO", country); - IsNotValid("JSDF3DF", country); - IsNotValid("KNJS9JS", country); - IsNotValid("LODF0DF", country); - IsNotValid("MEDS2DS", country); - IsNotValid("NNRF3RF", country); - IsNotValid("OLWK4WK", country); - IsNotValid("PSSD7SD", country); - IsNotValid("QDPJ7PJ", country); - IsNotValid("RNKF5KF", country); - IsNotValid("SELS8LS", country); - IsNotValid("TMJD9JD", country); - IsNotValid("UFMO0MO", country); - IsNotValid("VEDF3DF", country); - IsNotValid("WLJS9JS", country); - IsNotValid("XMDF0DF", country); - IsNotValid("YEDS2DS", country); - IsNotValid("ZLRF3RF", country); - IsNotValid("ZZWK4WK", country); - } - - /// Tests patterns that should not be valid for Slovenia (SI). - [Test] - public void IsNotValidCustomCases_SI_All() - { - var country = Country.SI; - - IsNotValid("AA0000", country); - IsNotValid("AS0144", country); - IsNotValid("BJ1282", country); - IsNotValid("CD2037", country); - IsNotValid("DE3243", country); - IsNotValid("EO4008", country); - IsNotValid("FN5697", country); - IsNotValid("GF6282", country); - IsNotValid("HL7611", country); - IsNotValid("ID6767", country); - IsNotValid("JS8752", country); - IsNotValid("KN9999", country); - IsNotValid("LO0000", country); - IsNotValid("ME0144", country); - IsNotValid("NN1282", country); - IsNotValid("OL2037", country); - IsNotValid("PS3243", country); - IsNotValid("QD4008", country); - IsNotValid("RN5697", country); - IsNotValid("SE6282", country); - IsNotValid("TM7611", country); - IsNotValid("UF6767", country); - IsNotValid("VE8752", country); - IsNotValid("WL9999", country); - IsNotValid("XM0000", country); - IsNotValid("YE0144", country); - IsNotValid("ZL1282", country); - IsNotValid("ZZ2037", country); - } - - /// Tests patterns that should not be valid for Slovakia (SK). - [Test] - public void IsNotValidCustomCases_SK_All() - { - var country = Country.SK; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for San Marino (SM). - [Test] - public void IsNotValidCustomCases_SM_All() - { - var country = Country.SM; - - IsNotValid("00000", country); - IsNotValid("05125", country); - IsNotValid("16285", country); - IsNotValid("27037", country); - IsNotValid("36243", country); - IsNotValid("46890", country); - IsNotValid("47797", country); - IsNotValid("59693", country); - IsNotValid("66286", country); - IsNotValid("76614", country); - IsNotValid("66768", country); - IsNotValid("83759", country); - IsNotValid("99999", country); - } - - /// Tests patterns that should not be valid for Senegal (SN). - [Test] - public void IsNotValidCustomCases_SN_All() - { - var country = Country.SN; - - IsNotValid("AA00000", country); - IsNotValid("AB01234", country); - IsNotValid("BJ12823", country); - IsNotValid("CO20375", country); - IsNotValid("DE32434", country); - IsNotValid("EO40082", country); - IsNotValid("FN56978", country); - IsNotValid("GF62824", country); - IsNotValid("HL76113", country); - IsNotValid("ID67671", country); - IsNotValid("JS87523", country); - IsNotValid("KN99999", country); - IsNotValid("LO00000", country); - IsNotValid("ME01449", country); - IsNotValid("NN12823", country); - IsNotValid("OL20375", country); - IsNotValid("PS32434", country); - IsNotValid("QD40082", country); - IsNotValid("RN56978", country); - IsNotValid("SE62824", country); - IsNotValid("TM76113", country); - IsNotValid("UF67671", country); - IsNotValid("VE87523", country); - IsNotValid("WL99999", country); - IsNotValid("XM00000", country); - IsNotValid("YE01449", country); - IsNotValid("ZL12823", country); - IsNotValid("ZZ20375", country); - } - - /// Tests patterns that should not be valid for El Salvador (SV). - [Test] - public void IsNotValidCustomCases_SV_All() - { - var country = Country.SV; - - IsNotValid("00000", country); - IsNotValid("01001", country); - IsNotValid("01131", country); - IsNotValid("02131", country); - IsNotValid("02331", country); - IsNotValid("12234", country); - IsNotValid("27000", country); - IsNotValid("33248", country); - IsNotValid("48945", country); - IsNotValid("57640", country); - IsNotValid("62208", country); - IsNotValid("71645", country); - IsNotValid("67752", country); - IsNotValid("82782", country); - IsNotValid("99999", country); - } - - /// Tests patterns that should not be valid for Swaziland (SZ). - [Test] - public void IsNotValidCustomCases_SZ_All() - { - var country = Country.SZ; - - IsNotValid("A000", country); - IsNotValid("A014", country); - IsNotValid("B128", country); - IsNotValid("C203", country); - IsNotValid("D324", country); - IsNotValid("E400", country); - IsNotValid("F569", country); - IsNotValid("G628", country); - IsNotValid("I676", country); - IsNotValid("J875", country); - IsNotValid("K999", country); - IsNotValid("N128", country); - IsNotValid("O203", country); - IsNotValid("P324", country); - IsNotValid("Q400", country); - IsNotValid("R569", country); - IsNotValid("T761", country); - IsNotValid("U676", country); - IsNotValid("V875", country); - IsNotValid("W999", country); - IsNotValid("X000", country); - IsNotValid("Y014", country); - IsNotValid("Z128", country); - IsNotValid("Z999", country); - - IsNotValid("A00Z", country); - IsNotValid("0A14", country); - IsNotValid("1B28", country); - IsNotValid("2C03", country); - IsNotValid("3D24", country); - IsNotValid("E40A", country); - IsNotValid("F5B9", country); - IsNotValid("G6BB", country); - IsNotValid("H7A1", country); - IsNotValid("I6A6", country); - IsNotValid("875J", country); - IsNotValid("999K", country); - IsNotValid("000L", country); - IsNotValid("014M", country); - IsNotValid("128N", country); - IsNotValid("203O", country); - IsNotValid("324P", country); - IsNotValid("Q4J0", country); - IsNotValid("R5K6", country); - IsNotValid("S6L2", country); - IsNotValid("T7M6", country); - IsNotValid("U6N7", country); - IsNotValid("V8O7", country); - } - - /// Tests patterns that should not be valid for Turks And Caicos Islands (TC). - [Test] - public void IsNotValidCustomCases_TC_All() - { - var country = Country.TC; - - IsNotValid("AKCA1ZZ", country); - IsNotValid("TBCA1ZZ", country); - IsNotValid("TKDA1ZZ", country); - IsNotValid("TKCE1ZZ", country); - IsNotValid("TKCA9ZZ", country); - IsNotValid("TKCA1FZ", country); - IsNotValid("TKCA1ZG", country); - - IsNotValid("AADF0DF", country); - IsNotValid("ASDS0DS", country); - IsNotValid("BJRF1RF", country); - IsNotValid("CDWK2WK", country); - IsNotValid("DESD3SD", country); - IsNotValid("EOPJ4PJ", country); - IsNotValid("FNKF5KF", country); - IsNotValid("GFLS6LS", country); - IsNotValid("HLJD7JD", country); - IsNotValid("IDMO6MO", country); - IsNotValid("JSDF8DF", country); - IsNotValid("KNJS9JS", country); - IsNotValid("LODF0DF", country); - IsNotValid("MEDS0DS", country); - IsNotValid("NNRF1RF", country); - IsNotValid("OLWK2WK", country); - IsNotValid("PSSD3SD", country); - IsNotValid("QDPJ4PJ", country); - IsNotValid("RNKF5KF", country); - IsNotValid("SELS6LS", country); - IsNotValid("TMJD7JD", country); - IsNotValid("UFMO6MO", country); - IsNotValid("VEDF8DF", country); - IsNotValid("WLJS9JS", country); - IsNotValid("XMDF0DF", country); - IsNotValid("YEDS0DS", country); - IsNotValid("ZLRF1RF", country); - IsNotValid("ZZWK2WK", country); - } - - /// Tests patterns that should not be valid for Chad (TD). - [Test] - public void IsNotValidCustomCases_TD_All() - { - var country = Country.TD; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Thailand (TH). - [Test] - public void IsNotValidCustomCases_TH_All() - { - var country = Country.TH; - - IsNotValid("00000", country); - IsNotValid("00124", country); - IsNotValid("01283", country); - IsNotValid("02035", country); - IsNotValid("03244", country); - IsNotValid("04002", country); - IsNotValid("05698", country); - IsNotValid("06284", country); - IsNotValid("07613", country); - IsNotValid("06761", country); - IsNotValid("08753", country); - IsNotValid("09999", country); - } - - /// Tests patterns that should not be valid for Tajikistan (TJ). - [Test] - public void IsNotValidCustomCases_TJ_All() - { - var country = Country.TJ; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Turkmenistan (TM). - [Test] - public void IsNotValidCustomCases_TM_All() - { - var country = Country.TM; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Tunisia (TN). - [Test] - public void IsNotValidCustomCases_TN_All() - { - var country = Country.TN; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Turkey (TR). - [Test] - public void IsNotValidCustomCases_TR_All() - { - var country = Country.TR; - - IsNotValid("00000", country); - IsNotValid("00012", country); - IsNotValid("00128", country); - IsNotValid("00203", country); - IsNotValid("00324", country); - IsNotValid("00400", country); - IsNotValid("00569", country); - IsNotValid("00628", country); - IsNotValid("00761", country); - IsNotValid("00676", country); - IsNotValid("00875", country); - IsNotValid("00999", country); - } - - /// Tests patterns that should not be valid for Trinidad And Tobago (TT). - [Test] - public void IsNotValidCustomCases_TT_All() - { - var country = Country.TT; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Taiwan (TW). - [Test] - public void IsNotValidCustomCases_TW_All() - { - var country = Country.TW; - - IsNotValid("000000", country); - IsNotValid("001234", country); - IsNotValid("012823", country); - IsNotValid("020375", country); - IsNotValid("032434", country); - IsNotValid("040082", country); - IsNotValid("056978", country); - IsNotValid("062824", country); - IsNotValid("076113", country); - IsNotValid("067671", country); - IsNotValid("087523", country); - IsNotValid("099999", country); - } - - /// Tests patterns that should not be valid for Ukraine (UA). - [Test] - public void IsNotValidCustomCases_UA_All() - { - var country = Country.UA; - - IsNotValid("00000", country); - IsNotValid("00012", country); - IsNotValid("00123", country); - IsNotValid("00200", country); - IsNotValid("00326", country); - IsNotValid("00409", country); - IsNotValid("00566", country); - IsNotValid("00629", country); - IsNotValid("00763", country); - IsNotValid("00675", country); - IsNotValid("00871", country); - IsNotValid("00999", country); - } - - /// Tests patterns that should not be valid for United States (US). - [Test] - public void IsNotValidCustomCases_US_All() - { - var country = Country.US; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Uruguay (UY). - [Test] - public void IsNotValidCustomCases_UY_All() - { - var country = Country.UY; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Holy See (VA). - [Test] - public void IsNotValidCustomCases_VA_All() - { - var country = Country.VA; - - IsNotValid("00000", country); - IsNotValid("01234", country); - IsNotValid("12823", country); - IsNotValid("20375", country); - IsNotValid("32434", country); - IsNotValid("40082", country); - IsNotValid("56978", country); - IsNotValid("62824", country); - IsNotValid("76113", country); - IsNotValid("67671", country); - IsNotValid("87523", country); - IsNotValid("99999", country); - } - - /// Tests patterns that should not be valid for Saint Vincent And The Grenadines (VC). - [Test] - public void IsNotValidCustomCases_VC_All() - { - var country = Country.VC; - - IsNotValid("AA0000", country); - IsNotValid("AS0144", country); - IsNotValid("BJ1282", country); - IsNotValid("CD2037", country); - IsNotValid("DE3243", country); - IsNotValid("EO4008", country); - IsNotValid("FN5697", country); - IsNotValid("GF6282", country); - IsNotValid("HL7611", country); - IsNotValid("ID6767", country); - IsNotValid("JS8752", country); - IsNotValid("KN9999", country); - IsNotValid("LO0000", country); - IsNotValid("ME0144", country); - IsNotValid("NN1282", country); - IsNotValid("OL2037", country); - IsNotValid("PS3243", country); - IsNotValid("QD4008", country); - IsNotValid("RN5697", country); - IsNotValid("SE6282", country); - IsNotValid("TM7611", country); - IsNotValid("UF6767", country); - IsNotValid("VE8752", country); - IsNotValid("WL9999", country); - IsNotValid("XM0000", country); - IsNotValid("YE0144", country); - IsNotValid("ZL1282", country); - IsNotValid("ZZ2037", country); - } - - /// Tests patterns that should not be valid for Venezuela (VE). - [Test] - public void IsNotValidCustomCases_VE_All() - { - var country = Country.VE; - - IsNotValid("00000", country); - IsNotValid("01223", country); - IsNotValid("12334", country); - IsNotValid("20400", country); - IsNotValid("32764", country); - IsNotValid("40794", country); - IsNotValid("56564", country); - IsNotValid("62890", country); - IsNotValid("76934", country); - IsNotValid("67055", country); - IsNotValid("87318", country); - IsNotValid("99999", country); - - IsNotValid("000A", country); - IsNotValid("032A", country); - IsNotValid("143B", country); - IsNotValid("204C", country); - IsNotValid("347D", country); - IsNotValid("447E", country); - IsNotValid("545F", country); - IsNotValid("608G", country); - IsNotValid("749H", country); - IsNotValid("J650I", country); - IsNotValid("K8832", country); - IsNotValid("L9999", country); - IsNotValid("M0000", country); - IsNotValid("N0325", country); - IsNotValid("O1436", country); - IsNotValid("20412", country); - IsNotValid("34787", country); - IsNotValid("44757", country); - IsNotValid("54505", country); - IsNotValid("60888", country); - } - - /// Tests patterns that should not be valid for Virgin Islands (VG). - [Test] - public void IsNotValidCustomCases_VG_All() - { - var country = Country.VG; - - IsNotValid("0123", country); - IsNotValid("1187", country); - IsNotValid("1199", country); - IsNotValid("1234", country); - IsNotValid("2000", country); - IsNotValid("3248", country); - IsNotValid("4945", country); - IsNotValid("5640", country); - IsNotValid("6208", country); - IsNotValid("7645", country); - IsNotValid("6752", country); - IsNotValid("8782", country); - IsNotValid("9999", country); - - IsNotValid("VG0123", country); - IsNotValid("VG1187", country); - IsNotValid("VG1199", country); - IsNotValid("VG1234", country); - IsNotValid("VG2000", country); - IsNotValid("VG3248", country); - IsNotValid("VG4945", country); - IsNotValid("VG5640", country); - IsNotValid("VG6208", country); - IsNotValid("VG7645", country); - IsNotValid("VG6752", country); - IsNotValid("VG8782", country); - IsNotValid("VG9999", country); - } - - /// Tests patterns that should not be valid for Virgin Islands (VI). - [Test] - public void IsNotValidCustomCases_VI_All() - { - var country = Country.VI; - - IsNotValid("00000", country); - IsNotValid("01235", country); - IsNotValid("12346", country); - IsNotValid("20004", country); - IsNotValid("32648", country); - IsNotValid("40945", country); - IsNotValid("56640", country); - IsNotValid("62908", country); - IsNotValid("76345", country); - IsNotValid("67552", country); - IsNotValid("87182", country); - IsNotValid("99999", country); - IsNotValid("000000000", country); - IsNotValid("013582794", country); - IsNotValid("124678364", country); - IsNotValid("200424690", country); - IsNotValid("324813434", country); - IsNotValid("404571855", country); - IsNotValid("564023918", country); - IsNotValid("620899999", country); - IsNotValid("764500000", country); - IsNotValid("675249423", country); - IsNotValid("878227947", country); - IsNotValid("999999999", country); - - IsNotValid("00800", country); - IsNotValid("00804", country); - IsNotValid("00869", country); - IsNotValid("00870", country); - IsNotValid("00860", country); - IsNotValid("00881", country); - IsNotValid("00892", country); - IsNotValid("008000000", country); - IsNotValid("008041235", country); - IsNotValid("008692908", country); - IsNotValid("008706345", country); - IsNotValid("008607552", country); - IsNotValid("008817182", country); - IsNotValid("008929999", country); - } - - /// Tests patterns that should not be valid for Viet Nam (VN). - [Test] - public void IsNotValidCustomCases_VN_All() - { - var country = Country.VN; - - IsNotValid("0", country); - } - - /// Tests patterns that should not be valid for Wallis And Futuna (WF). - [Test] - public void IsNotValidCustomCases_WF_All() - { - var country = Country.WF; - - IsNotValid("00000", country); - IsNotValid("01235", country); - IsNotValid("12346", country); - IsNotValid("20004", country); - IsNotValid("32648", country); - IsNotValid("40945", country); - IsNotValid("56640", country); - IsNotValid("62908", country); - IsNotValid("76345", country); - IsNotValid("67552", country); - IsNotValid("87182", country); - IsNotValid("99999", country); - } - - /// Tests patterns that should not be valid for Mayotte (YT). - [Test] - public void IsNotValidCustomCases_YT_All() - { - var country = Country.YT; - - IsNotValid("M11AA", country); - IsNotValid("M11aA", country); - IsNotValid("M11AA", country); - IsNotValid("m11AA", country); - IsNotValid("m11aa", country); - - IsNotValid("B338TH", country); - IsNotValid("B338TH", country); - - IsNotValid("CR26XH", country); - IsNotValid("CR26XH", country); - - IsNotValid("DN551PT", country); - IsNotValid("DN551PT", country); - - IsNotValid("W1A1HQ", country); - IsNotValid("W1A1HQ", country); - - IsNotValid("EC1A1BB", country); - IsNotValid("EC1A1BB", country); - } - - /// Tests patterns that should not be valid for South Africa (ZA). - [Test] - public void IsNotValidCustomCases_ZA_All() - { - var country = Country.ZA; - - IsNotValid("0000", country); - } - - /// Tests patterns that should not be valid for Zambia (ZM). - [Test] - public void IsNotValidCustomCases_ZM_All() - { - var country = Country.ZM; - - IsNotValid("0", country); - } - - #endregion - private static void IsNotValid(string code, Country country) { Assert.IsFalse(PostalCode.IsValid(code, country), "Postal code '{0}' should be not valid for {1:f}.", code, country); diff --git a/test/Qowaiv.UnitTests/Security/Cryptography/CryptographicSeedTest.cs b/test/Qowaiv.UnitTests/Security/Cryptography/CryptographicSeedTest.cs index 00db5bc9d..dd9b76a4a 100644 --- a/test/Qowaiv.UnitTests/Security/Cryptography/CryptographicSeedTest.cs +++ b/test/Qowaiv.UnitTests/Security/Cryptography/CryptographicSeedTest.cs @@ -154,7 +154,7 @@ public void Constructor_SerializationInfoIsNull_ThrowsArgumentNullException() ExceptionAssert.CatchArgumentNullException (() => { - SerializationTest.DeserializeUsingConstructor(null, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(null, default); }, "info"); } @@ -166,7 +166,7 @@ public void Constructor_InvalidSerializationInfo_ThrowsSerializationException() (() => { var info = new SerializationInfo(typeof(CryptographicSeed), new System.Runtime.Serialization.FormatterConverter()); - SerializationTest.DeserializeUsingConstructor(info, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(info, default); }); } @@ -177,7 +177,7 @@ public void GetObjectData_Null_ThrowsArgumentNullException() (() => { ISerializable obj = TestStruct; - obj.GetObjectData(null, default(StreamingContext)); + obj.GetObjectData(null, default); }, "info"); } @@ -187,7 +187,7 @@ public void GetObjectData_SerializationInfo_AreEqual() { ISerializable obj = TestStruct; var info = new SerializationInfo(typeof(CryptographicSeed), new System.Runtime.Serialization.FormatterConverter()); - obj.GetObjectData(info, default(StreamingContext)); + obj.GetObjectData(info, default); CollectionAssert.AreEqual(new byte[] { 66, 140, 26, 138 }, (byte[])info.GetValue("Value", typeof(byte[]))); } diff --git a/test/Qowaiv.UnitTests/Statistics/EloTest.cs b/test/Qowaiv.UnitTests/Statistics/EloTest.cs index b62b5448d..6d75e44c1 100644 --- a/test/Qowaiv.UnitTests/Statistics/EloTest.cs +++ b/test/Qowaiv.UnitTests/Statistics/EloTest.cs @@ -134,7 +134,7 @@ public void Constructor_SerializationInfoIsNull_ThrowsArgumentNullException() ExceptionAssert.CatchArgumentNullException (() => { - SerializationTest.DeserializeUsingConstructor(null, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(null, default); }, "info"); } @@ -146,7 +146,7 @@ public void Constructor_InvalidSerializationInfo_ThrowsSerializationException() (() => { var info = new SerializationInfo(typeof(Elo), new System.Runtime.Serialization.FormatterConverter()); - SerializationTest.DeserializeUsingConstructor(info, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(info, default); }); } @@ -157,7 +157,7 @@ public void GetObjectData_Null_ThrowsArgumentNullException() (() => { ISerializable obj = TestStruct; - obj.GetObjectData(null, default(StreamingContext)); + obj.GetObjectData(null, default); }, "info"); } @@ -167,7 +167,7 @@ public void GetObjectData_SerializationInfo_AreEqual() { ISerializable obj = TestStruct; var info = new SerializationInfo(typeof(Elo), new System.Runtime.Serialization.FormatterConverter()); - obj.GetObjectData(info, default(StreamingContext)); + obj.GetObjectData(info, default); Assert.AreEqual(1732.4000000000001, info.GetDouble("Value")); } diff --git a/test/Qowaiv.UnitTests/Text/WildcardPatternTest.cs b/test/Qowaiv.UnitTests/Text/WildcardPatternTest.cs index 41c9388f7..dfe5ac13e 100644 --- a/test/Qowaiv.UnitTests/Text/WildcardPatternTest.cs +++ b/test/Qowaiv.UnitTests/Text/WildcardPatternTest.cs @@ -182,7 +182,7 @@ public void Constructor_SerializationInfoIsNull_ThrowsArgumentNullException() ExceptionAssert.CatchArgumentNullException (() => { - SerializationTest.DeserializeUsingConstructor(null, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(null, default); }, "info"); } @@ -194,7 +194,7 @@ public void Constructor_InvalidSerializationInfo_ThrowsSerializationException() (() => { var info = new SerializationInfo(typeof(WildcardPattern), new System.Runtime.Serialization.FormatterConverter()); - SerializationTest.DeserializeUsingConstructor(info, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(info, default); }); } @@ -205,7 +205,7 @@ public void GetObjectData_Null_ThrowsArgumentNullException() (() => { ISerializable obj = new WildcardPattern("*"); - obj.GetObjectData(null, default(StreamingContext)); + obj.GetObjectData(null, default); }, "info"); } @@ -215,7 +215,7 @@ public void GetObjectData_SerializationInfo_AreEqual() { ISerializable obj = TestPattern; var info = new SerializationInfo(typeof(Date), new System.Runtime.Serialization.FormatterConverter()); - obj.GetObjectData(info, default(StreamingContext)); + obj.GetObjectData(info, default); Assert.AreEqual("t?st*", info.GetString("Pattern")); Assert.AreEqual((int)WildcardPatternOptions.SingleOrTrailing, info.GetInt32("Options")); diff --git a/test/Qowaiv.UnitTests/Threading/ThreadDomainTest.cs b/test/Qowaiv.UnitTests/Threading/ThreadDomainTest.cs index 501f35834..2f6547735 100644 --- a/test/Qowaiv.UnitTests/Threading/ThreadDomainTest.cs +++ b/test/Qowaiv.UnitTests/Threading/ThreadDomainTest.cs @@ -58,16 +58,6 @@ public void Get_Object_ThrowsNotSupportedException() "Converter can not convert from System.String."); } - [Test] - public void Get_StreamSizeByConfiguration_12kB() - { - ConfigurationManager.AppSettings["Qowaiv.IO.StreamSize"] = "12kB"; - StreamSize act = ThreadDomain.Current.Get(); - StreamSize exp = 12000; - - Assert.AreEqual(exp, act); - } - [Test] public void Get_CountryByCreator_Portugal() { diff --git a/test/Qowaiv.UnitTests/UuidTest.cs b/test/Qowaiv.UnitTests/UuidTest.cs index cc09c7e91..bf8f42499 100644 --- a/test/Qowaiv.UnitTests/UuidTest.cs +++ b/test/Qowaiv.UnitTests/UuidTest.cs @@ -137,7 +137,7 @@ public void Constructor_SerializationInfoIsNull_ThrowsArgumentNullException() ExceptionAssert.CatchArgumentNullException (() => { - SerializationTest.DeserializeUsingConstructor(null, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(null, default); }, "info"); } @@ -149,7 +149,7 @@ public void Constructor_InvalidSerializationInfo_ThrowsSerializationException() (() => { var info = new SerializationInfo(typeof(Uuid), new System.Runtime.Serialization.FormatterConverter()); - SerializationTest.DeserializeUsingConstructor(info, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(info, default); }); } @@ -160,7 +160,7 @@ public void GetObjectData_Null_ThrowsArgumentNullException() (() => { ISerializable obj = TestStruct; - obj.GetObjectData(null, default(StreamingContext)); + obj.GetObjectData(null, default); }, "info"); } @@ -170,7 +170,7 @@ public void GetObjectData_SerializationInfo_AreEqual() { ISerializable obj = TestStruct; var info = new SerializationInfo(typeof(Uuid), new System.Runtime.Serialization.FormatterConverter()); - obj.GetObjectData(info, default(StreamingContext)); + obj.GetObjectData(info, default); Assert.AreEqual(TestGuid, info.GetValue("Value", typeof(Guid))); } diff --git a/test/Qowaiv.Web.UnitTests/InternetMediaTypeTest.cs b/test/Qowaiv.UnitTests/Web/InternetMediaTypeTest.cs similarity index 94% rename from test/Qowaiv.Web.UnitTests/InternetMediaTypeTest.cs rename to test/Qowaiv.UnitTests/Web/InternetMediaTypeTest.cs index e49076a45..6ce8477cd 100644 --- a/test/Qowaiv.Web.UnitTests/InternetMediaTypeTest.cs +++ b/test/Qowaiv.UnitTests/Web/InternetMediaTypeTest.cs @@ -1,8 +1,7 @@ using NUnit.Framework; using Qowaiv.Globalization; using Qowaiv.TestTools; -using Qowaiv.UnitTests.Mocking.Web; -using Qowaiv.Web.UnitTests.Mocking; +using Qowaiv.Web; using System; using System.Collections.Generic; using System.Globalization; @@ -11,7 +10,7 @@ using System.Runtime.Serialization; using System.Xml.Serialization; -namespace Qowaiv.Web.UnitTests +namespace Qowaiv.UnitTests.Web { /// Tests the Internet media type SVO. public class InternetMediaTypeTest @@ -103,11 +102,9 @@ public void IsEmptyOrUnknown_TestStruct_IsFalse() [Test] public void TyrParse_Null_IsValid() { - InternetMediaType val; - string str = null; - Assert.IsTrue(InternetMediaType.TryParse(str, out val), "Valid"); + Assert.IsTrue(InternetMediaType.TryParse(str, out var val), "Valid"); Assert.AreEqual(string.Empty, val.ToString(), "Value"); } @@ -115,11 +112,10 @@ public void TyrParse_Null_IsValid() [Test] public void TyrParse_StringEmpty_IsValid() { - InternetMediaType val; string str = string.Empty; - Assert.IsTrue(InternetMediaType.TryParse(str, out val), "Valid"); + Assert.IsTrue(InternetMediaType.TryParse(str, out var val), "Valid"); Assert.AreEqual(string.Empty, val.ToString(), "Value"); } @@ -127,11 +123,9 @@ public void TyrParse_StringEmpty_IsValid() [Test] public void TyrParse_Questionmark_IsValid() { - InternetMediaType val; - string str = "?"; - Assert.IsTrue(InternetMediaType.TryParse(str, out val), "Valid"); + Assert.IsTrue(InternetMediaType.TryParse(str, out var val), "Valid"); Assert.IsTrue(val.IsUnknown(), "Value"); } @@ -139,11 +133,9 @@ public void TyrParse_Questionmark_IsValid() [Test] public void TyrParse_StringValue_IsValid() { - InternetMediaType val; - string str = "application/atom+xml"; - Assert.IsTrue(InternetMediaType.TryParse(str, out val), "Valid"); + Assert.IsTrue(InternetMediaType.TryParse(str, out var val), "Valid"); Assert.AreEqual(str, val.ToString(), "Value"); } @@ -151,11 +143,9 @@ public void TyrParse_StringValue_IsValid() [Test] public void TyrParse_StringValue_IsNotValid() { - InternetMediaType val; - string str = "string"; - Assert.IsFalse(InternetMediaType.TryParse(str, out val), "Valid"); + Assert.IsFalse(InternetMediaType.TryParse(str, out var val), "Valid"); Assert.AreEqual(string.Empty, val.ToString(), "Value"); } @@ -267,7 +257,7 @@ public void Constructor_SerializationInfoIsNull_ThrowsArgumentNullException() ExceptionAssert.CatchArgumentNullException (() => { - SerializationTest.DeserializeUsingConstructor(null, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(null, default); }, "info"); } @@ -279,7 +269,7 @@ public void Constructor_InvalidSerializationInfo_ThrowsSerializationException() (() => { var info = new SerializationInfo(typeof(InternetMediaType), new System.Runtime.Serialization.FormatterConverter()); - SerializationTest.DeserializeUsingConstructor(info, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(info, default); }); } @@ -290,7 +280,7 @@ public void GetObjectData_Null_ThrowsArgumentNullException() (() => { ISerializable obj = TestStruct; - obj.GetObjectData(null, default(StreamingContext)); + obj.GetObjectData(null, default); }, "info"); } @@ -300,7 +290,7 @@ public void GetObjectData_SerializationInfo_AreEqual() { ISerializable obj = TestStruct; var info = new SerializationInfo(typeof(InternetMediaType), new System.Runtime.Serialization.FormatterConverter()); - obj.GetObjectData(info, default(StreamingContext)); + obj.GetObjectData(info, default); Assert.AreEqual("application/x-chess-pgn", info.GetString("Value")); } @@ -1014,56 +1004,6 @@ public void IsValid_Data_IsTrue() Assert.IsTrue(InternetMediaType.IsValid("VIDEO/Mp3")); } #endregion - - #region Extension methods - - [Test] - public void GetContentType_HttpRequest_TextHtml() - { - var request = new HttpRequestMock() { ContentType = "text/html" }; - - var act = request.GetContentType(); - var exp = TextHtml; - - Assert.AreEqual(exp, act); - } - [Test] - public void SetContentType_HttpRequestTestStruct_TextHtml() - { - var request = new HttpRequestMock(); - - request.SetContentType(TestStruct); - - var act = request.ContentType; - var exp = TestStruct.ToString(); - - Assert.AreEqual(exp, act); - } - - [Test] - public void GetContentType_HttpResponse_TextHtml() - { - var response = new HttpResponseMock() { ContentType = "text/html" }; - - var act = response.GetContentType(); - var exp = TextHtml; - - Assert.AreEqual(exp, act); - } - [Test] - public void SetContentType_HttpResponseTestStruct_TextHtml() - { - var response = new HttpResponseMock(); - - response.SetContentType(TestStruct); - - var act = response.ContentType; - var exp = TestStruct.ToString(); - - Assert.AreEqual(exp, act); - } - - #endregion } [Serializable] diff --git a/test/Qowaiv.UnitTests/WeekDateTest.cs b/test/Qowaiv.UnitTests/WeekDateTest.cs index c5418ebef..3c1450f11 100644 --- a/test/Qowaiv.UnitTests/WeekDateTest.cs +++ b/test/Qowaiv.UnitTests/WeekDateTest.cs @@ -214,7 +214,7 @@ public void Constructor_SerializationInfoIsNull_ThrowsArgumentNullException() ExceptionAssert.CatchArgumentNullException (() => { - SerializationTest.DeserializeUsingConstructor(null, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(null, default); }, "info"); } @@ -226,7 +226,7 @@ public void Constructor_InvalidSerializationInfo_ThrowsSerializationException() (() => { var info = new SerializationInfo(typeof(WeekDate), new System.Runtime.Serialization.FormatterConverter()); - SerializationTest.DeserializeUsingConstructor(info, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(info, default); }); } @@ -237,7 +237,7 @@ public void GetObjectData_Null_ThrowsArgumentNullException() (() => { ISerializable obj = TestStruct; - obj.GetObjectData(null, default(StreamingContext)); + obj.GetObjectData(null, default); }, "info"); } @@ -247,7 +247,7 @@ public void GetObjectData_SerializationInfo_AreEqual() { ISerializable obj = TestStruct; var info = new SerializationInfo(typeof(WeekDate), new System.Runtime.Serialization.FormatterConverter()); - obj.GetObjectData(info, default(StreamingContext)); + obj.GetObjectData(info, default); Assert.AreEqual((DateTime)TestStruct, info.GetDateTime("Value")); } diff --git a/test/Qowaiv.UnitTests/YearTest.cs b/test/Qowaiv.UnitTests/YearTest.cs index 6963a0da5..9fbb4ccbb 100644 --- a/test/Qowaiv.UnitTests/YearTest.cs +++ b/test/Qowaiv.UnitTests/YearTest.cs @@ -259,7 +259,7 @@ public void Constructor_SerializationInfoIsNull_ThrowsArgumentNullException() ExceptionAssert.CatchArgumentNullException (() => { - SerializationTest.DeserializeUsingConstructor(null, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(null, default); }, "info"); } @@ -271,7 +271,7 @@ public void Constructor_InvalidSerializationInfo_ThrowsSerializationException() (() => { var info = new SerializationInfo(typeof(Year), new System.Runtime.Serialization.FormatterConverter()); - SerializationTest.DeserializeUsingConstructor(info, default(StreamingContext)); + SerializationTest.DeserializeUsingConstructor(info, default); }); } @@ -282,7 +282,7 @@ public void GetObjectData_Null_ThrowsArgumentNullException() (() => { ISerializable obj = TestStruct; - obj.GetObjectData(null, default(StreamingContext)); + obj.GetObjectData(null, default); }, "info"); } @@ -292,7 +292,7 @@ public void GetObjectData_SerializationInfo_AreEqual() { ISerializable obj = TestStruct; var info = new SerializationInfo(typeof(Year), new System.Runtime.Serialization.FormatterConverter()); - obj.GetObjectData(info, default(StreamingContext)); + obj.GetObjectData(info, default); Assert.AreEqual(1979, info.GetInt16("Value")); } diff --git a/test/Qowaiv.UnitTests/YesNoTest.cs b/test/Qowaiv.UnitTests/YesNoTest.cs index ed2a53920..98a5bbda5 100644 --- a/test/Qowaiv.UnitTests/YesNoTest.cs +++ b/test/Qowaiv.UnitTests/YesNoTest.cs @@ -225,7 +225,7 @@ public void Constructor_SerializationInfoIsNull_ThrowsArgumentNullException() (() => { SerializationTest.DeserializeUsingConstructor - (null, default(StreamingContext)); + (null, default); }, "info"); } @@ -238,7 +238,7 @@ public void Constructor_InvalidSerializationInfo_ThrowsSerializationException() { var info = new SerializationInfo(typeof(YesNo), new System.Runtime.Serialization.FormatterConverter()); SerializationTest.DeserializeUsingConstructor - (info, default(StreamingContext)); + (info, default); }); } @@ -249,7 +249,7 @@ public void GetObjectData_Null_ThrowsArgumentNullException() (() => { ISerializable obj = TestStruct; - obj.GetObjectData(null, default(StreamingContext)); + obj.GetObjectData(null, default); }, "info"); } @@ -259,7 +259,7 @@ public void GetObjectData_SerializationInfo_AreEqual() { ISerializable obj = TestStruct; var info = new SerializationInfo(typeof(YesNo), new System.Runtime.Serialization.FormatterConverter()); - obj.GetObjectData(info, default(StreamingContext)); + obj.GetObjectData(info, default); Assert.AreEqual((Byte)2, info.GetByte("Value")); } diff --git a/test/Qowaiv.Web.UnitTests/AssemblyTest.cs b/test/Qowaiv.Web.UnitTests/AssemblyTest.cs deleted file mode 100644 index 304a1fa51..000000000 --- a/test/Qowaiv.Web.UnitTests/AssemblyTest.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Qowaiv.TestTools; -using System; - -namespace Qowaiv.Web.Tests -{ - public class AssemblyTest : AssemblyTestBase - { - protected override Type AssemblyType => typeof(InternetMediaType); - - protected override Type[] Svos => new[] - { - typeof(InternetMediaType), - }; - } -} diff --git a/test/Qowaiv.Web.UnitTests/Mocking/HttpRequestMock.cs b/test/Qowaiv.Web.UnitTests/Mocking/HttpRequestMock.cs deleted file mode 100644 index f200d79af..000000000 --- a/test/Qowaiv.Web.UnitTests/Mocking/HttpRequestMock.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Web; - -namespace Qowaiv.Web.UnitTests.Mocking -{ - /// Represents a mocked HTTP-request. - public class HttpRequestMock : HttpRequestBase - { - /// Gets and set the content-type. - public override string ContentType { get; set; } - } -} diff --git a/test/Qowaiv.Web.UnitTests/Mocking/HttpResponseMock.cs b/test/Qowaiv.Web.UnitTests/Mocking/HttpResponseMock.cs deleted file mode 100644 index c224af9f4..000000000 --- a/test/Qowaiv.Web.UnitTests/Mocking/HttpResponseMock.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Web; - -namespace Qowaiv.UnitTests.Mocking.Web -{ - /// Represents a mocked HTTP-response. - public class HttpResponseMock : HttpResponseBase - { - /// Gets and set the content-type. - public override string ContentType - { - get { return m_ContentType; } - set { m_ContentType = value; } - } - private string m_ContentType; - } -} diff --git a/test/Qowaiv.Web.UnitTests/Mvc/TypeConverterModelBinderTest.cs b/test/Qowaiv.Web.UnitTests/Mvc/TypeConverterModelBinderTest.cs deleted file mode 100644 index a48ebb489..000000000 --- a/test/Qowaiv.Web.UnitTests/Mvc/TypeConverterModelBinderTest.cs +++ /dev/null @@ -1,48 +0,0 @@ -using NUnit.Framework; -using Qowaiv.Web.Mvc; -using System.Linq; - -namespace Qowaiv.Web.UnitTests.Mvc -{ - public class TypeConverterModelBinderTest - { - [Test] - public void Initialize_None_CountEquals() - { - var act = TypeConverterModelBinder.Types.ToArray(); - - Assert.AreEqual(21, act.Length); - } - - [Test] - public void AddType_Int32_OneItemAdded() - { - try - { - var exp = TypeConverterModelBinder.Types.Count() + 1; - TypeConverterModelBinder.AddType(typeof(int)); - var act = TypeConverterModelBinder.Types.Count(); - - Assert.AreEqual(exp, act); - } - finally - { - // Cleanup - TypeConverterModelBinder.RemoveType(typeof(int)); - } - } - - [Test] - public void AddType_ClassWithoutConverter_NothingAdded() - { - var exp = TypeConverterModelBinder.Types.Count(); - TypeConverterModelBinder.AddType(typeof(ClassWithoutConverter)); - var act = TypeConverterModelBinder.Types.Count(); - - Assert.AreEqual(exp, act); - } - } - - public class ClassWithoutConverter { } - -} diff --git a/test/Qowaiv.Web.UnitTests/Qowaiv.Web.UnitTests.csproj b/test/Qowaiv.Web.UnitTests/Qowaiv.Web.UnitTests.csproj deleted file mode 100644 index 8fc14ba8b..000000000 --- a/test/Qowaiv.Web.UnitTests/Qowaiv.Web.UnitTests.csproj +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - netcoreapp2.1 - Qowaiv.UnitTests - - - - - - - - - - - - - - - - - - diff --git a/tooling/Qowaiv.TestTools/ComponentModel/DataAnnotationsAssert.cs b/tooling/Qowaiv.TestTools/ComponentModel/DataAnnotationsAssert.cs index 783ea9720..f3c4c3f7b 100644 --- a/tooling/Qowaiv.TestTools/ComponentModel/DataAnnotationsAssert.cs +++ b/tooling/Qowaiv.TestTools/ComponentModel/DataAnnotationsAssert.cs @@ -9,11 +9,11 @@ public static class DataAnnotationsAssert { /// Asserts that the model is valid, throws if not. [DebuggerStepThrough] - public static void IsValid(T model) => IsValid(model, null); + public static void IsValid(T model) => IsValid(model, null); /// Asserts that the model is valid, throws if not. [DebuggerStepThrough] - public static void IsValid(T model, AnnotatedModelValidator validator) => WithErrors(model, new ValidationResult[0]); + public static void IsValid(T model, AnnotatedModelValidator validator) => WithErrors(model, validator, new ValidationResult[0]); /// Asserts the model to be invalid with specific messages. Throws if not. [DebuggerStepThrough] diff --git a/tooling/Qowaiv.TestTools/Qowaiv.TestTools.csproj b/tooling/Qowaiv.TestTools/Qowaiv.TestTools.csproj index 45968292b..4b425e59c 100644 --- a/tooling/Qowaiv.TestTools/Qowaiv.TestTools.csproj +++ b/tooling/Qowaiv.TestTools/Qowaiv.TestTools.csproj @@ -4,6 +4,7 @@ netstandard2.0 + 1.0.0