public void When_Seed_Then_RetunFillRepositoryWithDefaultUsers() { //Arrange ISeedUser sut = new SeedUser(_hasher); //Action sut.Seed(_repository); //Assert var users = _repository.List(); Assert.AreNotEqual(users.Count(), 0); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, SeedData seedData, SeedUser seedUser) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } seedData.Seed().Wait(); seedUser.Seed().Wait(); app.UseAuthentication(); app.UseMvc(); }
public void When_Seed_Then_RetunFillWithAdminUser() { //Arrange ISeedUser sut = new SeedUser(_hasher); //Action sut.Seed(_repository); //Assert var users = _repository.List(); var adminUser = users.Where(e => e.UserEmail == "*****@*****.**"); Assert.IsNotNull(adminUser); }
public static void Main(string[] args) { var host = CreateHostBuilder(args).Build(); using (var scope = host.Services.CreateScope()) { var service = scope.ServiceProvider; try { var context = service.GetRequiredService <DataContext> (); context.Database.Migrate(); SeedUser.Seed(context); // SeedWorldData.Seed(context); } catch (Exception ex) { throw ex; } } host.Run(); }