public void AddContextProviderMethodSadPath()
        {
            ILoggerBuilder builder = null;

            Action act = () => builder.AddContextProvider <TestContextProvider>();

            act.Should().ThrowExactly <ArgumentNullException>().WithMessage("*builder*");
        }
        /// <summary>
        /// Adds an <see cref="IContextProvider"/> of type <typeparamref name="TContextProvider"/> to the logger.
        /// </summary>
        /// <typeparam name="TContextProvider">The type of <see cref="IContextProvider"/> to add to the logger.</typeparam>
        /// <param name="builder">The <see cref="ILoggerBuilder"/>.</param>
        /// <param name="parameters">
        /// Constructor arguments for type <typeparamref name="TContextProvider"/> that are not provided by the
        /// <see cref="IServiceProvider"/>.
        /// </param>
        /// <returns>The same <see cref="ILoggerBuilder"/></returns>
        public static ILoggerBuilder AddContextProvider <TContextProvider>(this ILoggerBuilder builder, params object[] parameters)
            where TContextProvider : IContextProvider
        {
            if (builder is null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            return(builder.AddContextProvider(serviceProvider => ActivatorUtilities.CreateInstance <TContextProvider>(serviceProvider, parameters)));
        }
 /// <summary>
 /// Adds the <see cref="HttpContextProvider"/> to the logger builder.
 /// </summary>
 /// <param name="builder">The logger builder.</param>
 /// <returns>The same logger builder.</returns>
 public static ILoggerBuilder AddHttpContextProvider(this ILoggerBuilder builder) =>
 builder.AddContextProvider <HttpContextProvider>();