public void CreateHostBuilderPattern_CanFindHostBuilder()
        {
            var factory = HostFactoryResolver.ResolveHostBuilderFactory <IHostBuilder>(typeof(CreateHostBuilderPatternTestSite.Program).Assembly);

            Assert.NotNull(factory);
            Assert.IsAssignableFrom <IHostBuilder>(factory(Array.Empty <string>()));
        }
        /// <summary>
        /// Creates a <see cref="IHostBuilder"/> used to set up <see cref="TestServer"/>.
        /// </summary>
        /// <remarks>
        /// The default implementation of this method looks for a <c>public static IHostBuilder CreateHostBuilder(string[] args)</c>
        /// method defined on the entry point of the assembly of <typeparamref name="TEntryPoint" /> and invokes it passing an empty string
        /// array as arguments.
        /// </remarks>
        /// <returns>A <see cref="IHostBuilder"/> instance.</returns>
        protected virtual IHostBuilder CreateHostBuilder()
        {
            var hostBuilder = HostFactoryResolver.ResolveHostBuilderFactory <IHostBuilder>(typeof(TEntryPoint).Assembly)?.Invoke(Array.Empty <string>());

            if (hostBuilder != null)
            {
                hostBuilder.UseEnvironment(Environments.Development);
            }
            return(hostBuilder);
        }
        public void CreateHostBuilderPattern__Invalid_CantFindHostBuilder()
        {
            var factory = HostFactoryResolver.ResolveHostBuilderFactory <IHostBuilder>(typeof(CreateHostBuilderInvalidSignature.Program).Assembly);

            Assert.Null(factory);
        }