コード例 #1
0
        public virtual void RemoveLogin(RavenUserLogin ravenUserLogin)
        {
            if (ravenUserLogin == null)
            {
                throw new ArgumentNullException("ravenUserLogin");
            }

            _logins.Remove(ravenUserLogin);
        }
コード例 #2
0
        public async Task FindAsync_Should_Find_The_User_If_Login_Exists()
        {
            const string userName = "******";
            const string loginProvider = "Twitter";
            const string providerKey = "12345678";

            using (IDocumentStore store = CreateEmbeddableStore())
            {
                // Arrange
                using (IAsyncDocumentSession ses = store.OpenAsyncSession())
                {
                    ses.Advanced.UseOptimisticConcurrency = true;
                    IUserLoginStore<RavenUser, string> userLoginStore = new RavenUserStore<RavenUser>(ses);
                    RavenUser user = new RavenUser(userName);
                    RavenUserLogin userLogin = new RavenUserLogin(user.Id, new UserLoginInfo(loginProvider, providerKey));
                    user.AddLogin(userLogin);
                    await ses.StoreAsync(user);
                    await ses.StoreAsync(userLogin);
                    await ses.SaveChangesAsync();
                }

                using (IAsyncDocumentSession ses = store.OpenAsyncSession())
                {
                    ses.Advanced.UseOptimisticConcurrency = true;
                    IUserLoginStore<RavenUser, string> userLoginStore = new RavenUserStore<RavenUser>(ses);

                    // Act
                    UserLoginInfo loginInfo = new UserLoginInfo(loginProvider, providerKey);
                    RavenUser foundUser = await userLoginStore.FindAsync(loginInfo);

                    // Assert
                    Assert.NotNull(foundUser);
                    Assert.Equal(userName, foundUser.UserName);
                }
            }
        }
コード例 #3
0
ファイル: RavenUser.cs プロジェクト: adrugarte/stepProcessor
        public virtual void RemoveLogin(RavenUserLogin ravenUserLogin)
        {
            if (ravenUserLogin == null)
            {
                throw new ArgumentNullException("ravenUserLogin");
            }

            _logins.Remove(ravenUserLogin);
        }