public static TestServer CreateServer(
            Mock <IEmailService> emailServiceMock         = null,
            Action <TestConfigurationBuilder> configBuild = null,
            HttpMessageHandler messageHandler             = null)
        {
            return(new TestServerBuilder()
                   .UseEnvironment("Test")
                   .UseContentRoot()
                   .AddServices(services =>
            {
                if (emailServiceMock != null)
                {
                    services.AddSingleton(emailServiceMock.Object);
                }
            })
                   .AddStartup((environment) =>
            {
                var builder = new TestConfigurationBuilder()
                              .UseDefaultConfiguration();

                if (emailServiceMock != null)
                {
                    builder.RemoveDebugEmailModule();
                }

                if (configBuild != null)
                {
                    configBuild.Invoke(builder);
                }

                return new Startup(
                    builder.Build(),
                    environment,
                    new NullLogger <Startup>(),
                    messageHandler
                    );
            })
                   .Build());
        }