public void ShouldGenerateSpecified()
        {
            var fileName             = "file.env";
            var dotEnvOptionsBuilder = new DotEnvOptionsBuilder();

            var dotEnvOptions = dotEnvOptionsBuilder
                                .AddEncoding(Encoding.UTF32)
                                .AddEnvFile(fileName)
                                .AddThrowOnError(false)
                                .AddTrimOptions(true)
                                .Build();

            dotEnvOptions.Encoding.Should().Be(Encoding.UTF32);
            dotEnvOptions.EnvFile.Should().Be(fileName);
            dotEnvOptions.TrimValues.Should().BeTrue();
            dotEnvOptions.ThrowOnError.Should().BeFalse();
        }
        /// <summary>
        /// Add the environment vars using a service
        /// </summary>
        /// <param name="services">Service collection</param>
        /// <param name="setupAction">The dot env options buider action</param>
        /// <returns>The service collection</returns>
        /// <exception cref="ArgumentNullException">If the service passed in is null</exception>
        public static IServiceCollection AddEnv(this IServiceCollection services, Action <DotEnvOptionsBuilder> setupAction)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }
            if (setupAction == null)
            {
                throw new ArgumentNullException(nameof(setupAction));
            }

            DotEnvOptionsBuilder dotEnvOptionsBuilder = new DotEnvOptionsBuilder();

            setupAction(dotEnvOptionsBuilder);

            var dotEnvOptions = dotEnvOptionsBuilder.Build();

            DotEnv.Config(dotEnvOptions);

            return(services);
        }
        /// <summary>
        /// Add the environment variables using autofac
        /// </summary>
        /// <param name="containerBuilder">The container builder instance</param>
        /// <param name="action">The env builder action</param>
        /// <returns>The container builder instance</returns>
        /// <exception cref="ArgumentNullException">If the container builder or action is null</exception>
        public static ContainerBuilder AddEnv(this ContainerBuilder containerBuilder,
                                              Action <DotEnvOptionsBuilder> action)
        {
            if (containerBuilder == null)
            {
                throw new ArgumentNullException(nameof(containerBuilder));
            }

            if (action == null)
            {
                throw new ArgumentNullException(nameof(action));
            }

            var dotEnvOptionsBuilder = new DotEnvOptionsBuilder();

            action(dotEnvOptionsBuilder);

            var dotEnvOptions = dotEnvOptionsBuilder.Build();

            DotEnv.Config(dotEnvOptions);

            return(containerBuilder);
        }