Example #1
0
        protected TestServer CreateServer()
        {
            var connectionString = $"Data Source=(LocalDb)\\MSSQLLocalDB;Initial Catalog=NoteTakingAppIntegrationTests{Guid.NewGuid()};Integrated Security=SSPI;";

            var webHostBuilder = new WebHostBuilder()
                                 .UseStartup(typeof(Startup))
                                 .UseKestrel()
                                 .UseConfiguration(GetConfiguration())
                                 .ConfigureAppConfiguration((builderContext, config) =>
            {
                config
                .AddInMemoryCollection(new Dictionary <string, string>
                {
                    { "isTest", "true" },
                    { "Authentication:MaximumUsers", "2" },
                    { "Data:DefaultConnection:ConnectionString", connectionString }
                });
            });

            var testServer = new IntegrationTestServer(webHostBuilder);

            testServer.SeedDatabase();

            return(testServer);
        }
Example #2
0
        protected TestServer CreateServer()
        {
            var webHostBuilder = new WebHostBuilder()
                                 .UseStartup(typeof(Startup))
                                 .UseKestrel()
                                 .UseConfiguration(GetConfiguration())
                                 .ConfigureAppConfiguration((builderContext, config) =>
            {
                config
                .AddInMemoryCollection(new Dictionary <string, string>
                {
                    { "isTest", "true" },
                    { "Authentication:MaximumUsers", "2" }
                });
            });

            var testServer = new IntegrationTestServer(webHostBuilder);

            testServer.SeedDatabase();

            return(testServer);
        }