Beispiel #1
0
        public async void WithAlreadyExistingEmail_ShouldNotCreateNewUser()
        {
            var dbContext         = this.GetDbContext();
            var mockedUserManager = CommonGetMockMethods.GetUserManager();
            var dbUser            = SeedUsersMethods.SeedUser(dbContext, Guid.NewGuid().ToString());
            var service           = this.GetService(dbContext, mockedUserManager.Object);

            var dbRole       = SeedRolesMethods.SeedAdminRole(dbContext);
            var serviceModel = new UserServiceModel();

            serviceModel.Email = dbUser.Email;

            await service.SeedUserAsync(serviceModel, "", dbRole.Name);

            mockedUserManager.Verify(um => um.CreateAsync(It.IsAny <User>(), It.IsAny <string>()), Times.Never);
        }
 private void SeedAllRoles(ApplicationDbContext dbContext)
 {
     this.AdminRole = SeedRolesMethods.SeedAdminRole(dbContext);
     this.UserRole  = SeedRolesMethods.SeedUserRole(dbContext);
 }