public async Task UsersLoggedIn_TestAsync() { var userFilter1 = new UserFilter(UserFlags.Offline | UserFlags.NotBanned); var user1 = await userFilter1.GetUserAsync(app); var userFilter2 = new UserFilter(UserFlags.Offline | UserFlags.NotBanned) { ExcludedUserIDs = new[] { user1.ID } }; var user2 = await userFilter2.GetUserAsync(app); var actualUserID = string.Empty; await userCollection.AddUsersLoggedInEventHandlerAsync(UserCollection_UsersLoggedIn); Console.WriteLine(user1.UserState); var authentication1 = await this.TestContext.LoginAsync(user1.ID); Assert.AreEqual(authentication1.ID, actualUserID); await userCollection.RemoveUsersLoggedInEventHandlerAsync(UserCollection_UsersLoggedIn); var authentication2 = await this.TestContext.LoginAsync(user2.ID); Assert.AreEqual(authentication1.ID, actualUserID); Assert.AreNotEqual(authentication2.ID, actualUserID); void UserCollection_UsersLoggedIn(object sender, ItemsEventArgs <IUser> e) { var user = e.Items.Single(); actualUserID = user.ID; } }