Пример #1
0
        public void TheEmailAlreadyExistTest()
        {
            DbContextOptions <ATZBDbContext> options = new DbContextOptionsBuilder <ATZBDbContext>()
                                                       .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString())
                                                       .Options;
            ATZBDbContext context = new ATZBDbContext(options);

            UserService userService   = new UserService(context);
            string      emailForCheck = "*****@*****.**";

            SeedDbWithUsers(context, DataForSeedUsers);

            context.Users
            .AddRange(
                new List <ATZBUser>()
            {
                new ATZBUser()
                {
                    Email = emailForCheck
                },
                new ATZBUser()
                {
                    Email = emailForCheck
                }
            });
            context.SaveChanges();


            Assert.True(userService.EmailAlreadyExistAsync(emailForCheck).Result);
        }
Пример #2
0
 public void SeedDbWithUsers(ATZBDbContext context, List <ATZBUser> users)
 {
     context.Users.AddRange(users);
     context.SaveChanges();
 }
Пример #3
0
 public void SeedDbWithOrders(ATZBDbContext context)
 {
     context.AddRange();
     context.SaveChanges();
 }