public void should_create_unique_admin_user() { var userRepository = new MemoryRepository<User>(); var userCreationService = new UserCreateService(userRepository); var user = userCreationService.Create(Username, Password, Email, true, ""); user.Administrator.ShouldBeTrue(); }
public void should_create_user_password_hash() { var userRepository = new MemoryRepository<User>(); var userCreationService = new UserCreateService(userRepository); var user = userCreationService.Create(Username, Password, Email, false, ""); user.PasswordHash.ShouldNotBeNull(); user.PasswordHash.ShouldNotBeEmpty(); user.PasswordHash.ShouldNotEqual(Password); }
public void should_create_unique_non_admin_user() { var userRepository = new MemoryRepository<User>(); var userCreationService = new UserCreateService(userRepository); var user = userCreationService.Create(Username, Password, Email, false, ""); userRepository.Count().ShouldEqual(1); userRepository.First().ShouldEqual(user); user.Username.ShouldEqual(Username.ToLower()); user.Administrator.ShouldBeFalse(); user.Email.ShouldEqual(Email); }
public void generate_users() { var users = new UserCreateService(new MongoRepository<User>(new MongoConnection(Constants.VoltaAcceptanceConnectionString))); Enumerable.Range(1, 50).ToList().ForEach(x => users.Create(string.Format("testuser{0}", x), "t3$t", string.Format("test{0}@test.com", x), x % 5 == 0, "test")); }
public void should_not_create_user_with_empty_username() { var userCreationService = new UserCreateService(new MemoryRepository<User>()); Assert.Throws<EmptyUsernameException>(() => userCreationService.Create(string.Empty, Password, Email, false, "")); }
public void should_not_create_user_with_duplicate_differently_cased_usernames() { var userRepository = new MemoryRepository<User>(new User { Username = Username.ToUpper() }); var userCreationService = new UserCreateService(userRepository); Assert.Throws<DuplicateUsernameException>(() => userCreationService.Create(Username.ToLower(), Password, Email, false, "")); }