public void ToolStripRenderer_DrawArrow_Invoke_CallsRenderArrow(ToolStripItem toolStripItem, Rectangle arrowRectangle, Color arrowColor, ArrowDirection arrowDirection) { using var image = new Bitmap(10, 10); using Graphics graphics = Graphics.FromImage(image); var eventArgs = new ToolStripArrowRenderEventArgs(graphics, toolStripItem, arrowRectangle, arrowColor, arrowDirection); var renderer = new SubToolStripRenderer(); int callCount = 0; ToolStripArrowRenderEventHandler handler = (sender, e) => { Assert.Same(renderer, sender); Assert.Same(eventArgs, e); callCount++; }; // Call with handler. renderer.RenderArrow += handler; renderer.DrawArrow(eventArgs); Assert.Equal(1, callCount); // Remove handler. renderer.RenderArrow -= handler; renderer.DrawArrow(eventArgs); Assert.Equal(1, callCount); }
public void ToolStripRenderer_DrawArrow_NullE_ThrowsArgumentNullException() { var renderer = new SubToolStripRenderer(); Assert.Throws <ArgumentNullException>("e", () => renderer.DrawArrow(null)); }