public async Task ItemsChanged_TestAsync() { var authentication = await this.TestContext.LoginRandomAsync(Authority.Admin); var userCollection = userContext.GetService(typeof(IUserCollection)) as IUserCollection; var user = await userCollection.GetUserAsync(authentication.ID); var password = user.GetPassword(); var actualPath = string.Empty; var expectedName = RandomUtility.NextName(); await userContext.AddItemsChangedEventHandlerAsync(UserContext_ItemsChanged); await user.SetUserNameAsync(authentication, password, expectedName); Assert.AreEqual(user.Path, actualPath); await userContext.RemoveItemsChangedEventHandlerAsync(UserContext_ItemsChanged); await user.SetUserNameAsync(authentication, password, RandomUtility.NextName()); Assert.AreEqual(user.Path, actualPath); void UserContext_ItemsChanged(object sender, ItemsEventArgs <IUserItem> e) { var userItem = e.Items.Single(); actualPath = userItem.Path; } }