public async Task ItemsCreated_TestAsync() { var authentication = await this.TestContext.LoginRandomAsync(Authority.Admin); var actualPath = string.Empty; await userContext.AddItemsCreatedEventHandlerAsync(UserContext_ItemsCreated); var userItem1 = await userContext.GenerateAsync(authentication); Assert.AreEqual(userItem1.Path, actualPath); await userContext.RemoveItemsCreatedEventHandlerAsync(UserContext_ItemsCreated); var userItem2 = await userContext.GenerateAsync(authentication); Assert.AreEqual(userItem1.Path, actualPath); Assert.AreNotEqual(userItem2.Path, actualPath); void UserContext_ItemsCreated(object sender, ItemsCreatedEventArgs <IUserItem> e) { var userItem = e.Items.Single(); actualPath = userItem.Path; } }