public void Configure(IApplicationBuilder app, IHostingEnvironment env, TestDataSet seedData) { // Seeding our in memory database with the test data seedData.Users?.Select(x => app.ApplicationServices.GetService <AuthService>().Register( new RegisterRequestDTO { ClientId = "clientId", Password = x.Password, Username = x.Username })); seedData.Brands.Select(x => app.ApplicationServices.GetService <BrandRepository>().Create(x)); app.UseMvc(); }
/// <summary> /// This is the initial data that will be /// used to populate our in memory database /// </summary> /// <returns></returns> private TestDataSet TestData() { var testData = new TestDataSet { Users = new List <User>(), Brands = new List <Brand>() }; // Users testData.Users.Add(new User { Username = "******", Password = "******", Role = Role.User }); // Brands testData.Brands.Add(new Brand { Name = "Inte" }); testData.Brands.Add(new Brand { Name = "Amd" }); return(testData); }