// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, ApplicationDbContext context) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseIdentity(); // Add external authentication middleware below. To configure them please see https://go.microsoft.com/fwlink/?LinkID=532715 app.UseCors("CorsPolicy"); app.UseOAuthValidation(); app.UseOpenIddict(); app.UseMvcWithDefaultRoute(); SeedUserData.Initialize(context, app.ApplicationServices); }
public async Task OnGetAsyncPopulatesPageModel() { // Arrange: seed database with test data await PrepareTestContext(async(context) => { SeedUserData seedUserData = new SeedUserData(); // Cargar la lista de usuarios. seedUserData.CargarListaUsuarios(); var expected = seedUserData.ListaUsuarios; // Act: retrieve actors var pageModel = new IndexModel(context); await pageModel.OnGetAsync(null, 0); // Assert: seeded and retrieved actors match var actualMessages = Assert.IsAssignableFrom <List <ApplicationUser> >(pageModel.ClienteIdxData.Usuarios); Assert.Equal( expected.OrderBy(a => a.Email).Select(a => a.Name), actualMessages.OrderBy(a => a.Email).Select(a => a.Name)); }); }