public async Task CategoriesDeleted_TestAsync() { var authentication = await this.TestContext.LoginRandomAsync(Authority.Admin); var categoryFilter = new UserCategoryFilter() { HasParent = true, IsLeaf = true }; var category1 = await categoryFilter.GetUserCategoryAsync(app); var expectedPath = category1.Path; var actualPath = string.Empty; await userCategoryCollection.AddCategoriesDeletedEventHandlerAsync(UserCategoryCollection_CategoriesDeleted); await category1.DeleteAsync(authentication); Assert.AreEqual(expectedPath, actualPath); await userCategoryCollection.RemoveCategoriesDeletedEventHandlerAsync(UserCategoryCollection_CategoriesDeleted); var category2 = await categoryFilter.GetUserCategoryAsync(app); await category2.DeleteAsync(authentication); Assert.AreEqual(expectedPath, actualPath); void UserCategoryCollection_CategoriesDeleted(object sender, ItemsDeletedEventArgs <IUserCategory> e) { actualPath = e.ItemPaths.Single(); } }