public async Task ItemsRenamed_TestAsync() { var authentication = await this.TestContext.LoginRandomAsync(Authority.Admin); var categoryFilter = new UserCategoryFilter() { HasParent = true }; var category = await categoryFilter.GetUserCategoryAsync(app); var actualName = string.Empty; var actualPath = string.Empty; var actualOldName = string.Empty; var actualOldPath = string.Empty; var expectedName = await category.Parent.GenerateNewCategoryNameAsync(); var expectedOldName = category.Name; var expectedOldPath = category.Path; await userContext.AddItemsRenamedEventHandlerAsync(UserContext_ItemsRenamed); await category.RenameAsync(authentication, expectedName); Assert.AreEqual(expectedName, actualName); Assert.AreEqual(category.Path, actualPath); Assert.AreEqual(expectedOldName, actualOldName); Assert.AreEqual(expectedOldPath, actualOldPath); await userContext.RemoveItemsRenamedEventHandlerAsync(UserContext_ItemsRenamed); await category.RenameAsync(authentication, RandomUtility.NextName()); Assert.AreEqual(expectedName, actualName); Assert.AreNotEqual(category.Path, actualPath); Assert.AreEqual(expectedOldName, actualOldName); Assert.AreEqual(expectedOldPath, actualOldPath); void UserContext_ItemsRenamed(object sender, ItemsRenamedEventArgs <IUserItem> e) { var userItem = e.Items.Single(); actualName = userItem.Name; actualPath = userItem.Path; actualOldName = e.OldNames.Single(); actualOldPath = e.OldPaths.Single(); } }