コード例 #1
0
        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();
        }
コード例 #2
0
        /// <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);
        }