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); }
public void SeedDbWithUsers(ATZBDbContext context, List <ATZBUser> users) { context.Users.AddRange(users); context.SaveChanges(); }
public void SeedDbWithOrders(ATZBDbContext context) { context.AddRange(); context.SaveChanges(); }