/// <summary>
        /// Registers IbanNet services using specified options builder.
        /// </summary>
        /// <param name="services">The service collection.</param>
        /// <param name="configure">The options builder.</param>
        /// <param name="preserveStaticValidator"><see langword="true" /> to preserve the static validator in <see cref="Iban.Validator" />, or <see langword="false" /> to replace with the configured instance.</param>
        /// <returns>The service collection extended with IbanNet services.</returns>
        public static IServiceCollection AddIbanNet(this IServiceCollection services, Action <IIbanNetOptionsBuilder> configure, bool preserveStaticValidator)
        {
            if (configure is null)
            {
                throw new ArgumentNullException(nameof(configure));
            }

            services.AddIbanNet(preserveStaticValidator);

            var builder = new MicrosoftDependencyInjectionIbanNetOptionsBuilder(services);

            configure(builder);

            return(services);
        }
            public static IEnumerable <object[]> BuilderExtensionsWithoutBuilderInstance()
            {
                var instance = new MicrosoftDependencyInjectionIbanNetOptionsBuilder(new ServiceCollection());

                return(new NullArgumentTestCases
                {
                    // Instance
                    DelegateTestCase.Create <Action <DependencyResolverAdapter, IbanValidatorOptions>, IIbanNetOptionsBuilder>(
                        instance.Configure,
                        (s, o) => { }),

                    // Extensions
                    DelegateTestCase.Create <IIbanNetOptionsBuilder, Func <IServiceProvider, TestValidationRule>, IIbanNetOptionsBuilder>(
                        IbanNetOptionsBuilderExtensions.WithRule,
                        instance,
                        s => new TestValidationRule()),
                    DelegateTestCase.Create <IIbanNetOptionsBuilder, Action <IServiceProvider, IbanValidatorOptions>, IIbanNetOptionsBuilder>(
                        IbanNetOptionsBuilderExtensions.Configure,
                        instance,
                        (s, opts) => { })
                }.Flatten());
            }
 protected IbanNetOptionsBuilderTests()
 {
     _serviceCollection = new ServiceCollection()
                          .AddTransient <DependencyResolverAdapter, ServiceProviderDependencyResolverAdapter>();
     _builder = new MicrosoftDependencyInjectionIbanNetOptionsBuilder(_serviceCollection);
 }