protected OnPopup ( |
||
e | ||
Résultat | void |
public void ContextMenu_OnPopup_Invoke_Success() { var menu = new ContextMenu(); // No handler. menu.OnPopup(null); // Handler. int callCount = 0; EventHandler handler = (sender, e) => { Assert.Equal(menu, sender); callCount++; }; menu.Popup += handler; menu.OnPopup(null); Assert.Equal(1, callCount); // Should not call if the handler is removed. menu.Popup -= handler; menu.OnPopup(null); Assert.Equal(1, callCount); }