Inheritance: IUserService
コード例 #1
0
ファイル: Program.cs プロジェクト: RobertTheGrey/RavenGallery
 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 WhenUserExists_DoesUserExistWithUsernameAndPassword_ReturnsTrue()
        {
            using (var session = Store.OpenSession())
            {
                session.Store(new UserDocument()
                {
                    PasswordHash = HashUtil.HashPassword("password"),
                    Username = "******"
                });
                session.SaveChanges();
                WaitForIndexing();

                UserService service = new UserService(session);
                bool result = service.DoesUserExistWithUsernameAndPassword("testUser", "password");
                Assert.True(result);
            }
        }
コード例 #3
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);
            }
        }