public async Task UsersLoggedOut_TestAsync() { var authentication1 = await this.TestContext.LoginRandomAsync(); var authentication2 = await this.TestContext.LoginRandomAsync(); var user1 = await userCollection.GetUserAsync(authentication1.ID); var user2 = await userCollection.GetUserAsync(authentication2.ID); var actualUserID = string.Empty; await userCollection.AddUsersLoggedOutEventHandlerAsync(UserCollection_UsersLoggedOut); await this.TestContext.LogoutAsync(authentication1); Assert.AreEqual(user1.ID, actualUserID); await userCollection.RemoveUsersLoggedOutEventHandlerAsync(UserCollection_UsersLoggedOut); await this.TestContext.LogoutAsync(authentication2); Assert.AreEqual(user1.ID, actualUserID); Assert.AreNotEqual(user2.ID, actualUserID); void UserCollection_UsersLoggedOut(object sender, ItemsEventArgs <IUser> e) { var user = e.Items.Single(); actualUserID = user.ID; } }