DoesUserExistWithUsername() публичный Метод

public DoesUserExistWithUsername ( string username ) : bool
username string
Результат bool
Пример #1
0
 private static void PerformInitialSetup(IDocumentSession session)
 {
     IUserService userService = new UserService(session);
     if (!userService.DoesUserExistWithUsername("robashton"))
     {
         User newUser = new User("robashton", "password");
         IUserRepository userRepository = new UserRepository(session);
         userRepository.Add(newUser);
     }
     session.SaveChanges();
 }
Пример #2
0
        public void WhenUserDoesNotExist_DoesUserExistWithUsername_ReturnsFalse()
        {
            using (var session = Store.OpenSession())
            {
                session.Store(new UserDocument()
                {
                    PasswordHash = "pass",
                    Username = "******"
                });
                session.SaveChanges();
                WaitForIndexing();

                UserService service = new UserService(session);
                bool result = service.DoesUserExistWithUsername("testOtherUser");
                Assert.False(result);
            }
        }