public Task SeedAsync(DataSeedContext context)
 {
     return(_identityDataSeeder.SeedAsync(
                context["AdminEmail"] as string ?? "*****@*****.**",
                context["AdminPassword"] as string ?? "1q2w3E*",
                context.TenantId
                ));
 }
Esempio n. 2
0
        public async Task Should_Create_Admin_User_And_Role()
        {
            await _identityDataSeeder.SeedAsync("*****@*****.**", "1q2w3E*");

            (await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("admin"))).ShouldNotBeNull();
            (await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("admin"))).Name.ShouldBe("admin");
            (await _roleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("admin"))).ShouldNotBeNull();
        }
Esempio n. 3
0
        public async Task BuildInternalAsync()
        {
            await _identityDataSeeder.SeedAsync("1q2w3E*");

            await _bookRepository.InsertAsync(
                new Book
            {
                Id          = Guid.NewGuid(),
                Name        = "Test Book 1",
                Type        = BookType.Dystopia,
                PublishDate = new DateTime(1989, 05, 26),
                Price       = 29
            }
                );

            await _bookRepository.InsertAsync(
                new Book
            {
                Id          = Guid.NewGuid(),
                Name        = "Test Book 2",
                Type        = BookType.Horror,
                PublishDate = new DateTime(2016, 09, 07),
                Price       = 11
            });

            await _authorRepository.InsertAsync(
                new Author
            {
                FirstName = "Mehmet",
                LastName  = "Perk"
            }
                );

            await _authorRepository.InsertAsync(
                new Author
            {
                FirstName = "Yılmaz",
                LastName  = "Perk"
            }
                );
        }
Esempio n. 4
0
        /// <summary>
        /// 直接使用了identity模块实现的 IIdentityDataSeeder 接口,创建了一个admin角色和admin用户
        /// </summary>
        /// <returns></returns>
        public async Task BuildInternalAsync()
        {
            await _identityDataSeeder.SeedAsync("1q2w3E*");

            await _bookRepository.InsertAsync(
                new Book
            {
                Name        = "Test book 1",
                Type        = BookType.Fantastic,
                PublishDate = new DateTime(2019, 02, 20),
                Price       = 21.5F
            }
                );

            await _bookRepository.InsertAsync(
                new Book
            {
                Name        = "Test book 2",
                Type        = BookType.Science,
                PublishDate = new DateTime(2018, 02, 11),
                Price       = 15.4F
            }
                );
        }
Esempio n. 5
0
 public async Task BuildInternalAsync()
 {
     await _identityDataSeeder.SeedAsync("1q2w3E*");
 }