public virtual void RemoveLogin(RavenUserLogin ravenUserLogin) { if (ravenUserLogin == null) { throw new ArgumentNullException("ravenUserLogin"); } _logins.Remove(ravenUserLogin); }
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); } } }