Exemplo n.º 1
0
        public void ToolStripRenderer_DrawItemCheck_Invoke_CallsRenderItemCheck(Graphics graphics, ToolStripItem item, Image image, Rectangle imageRectangle)
        {
            var eventArgs = new ToolStripItemImageRenderEventArgs(graphics, item, image, imageRectangle);

            var renderer  = new SubToolStripRenderer();
            int callCount = 0;
            ToolStripItemImageRenderEventHandler handler = (sender, e) =>
            {
                Assert.Same(renderer, sender);
                Assert.Same(eventArgs, e);
                callCount++;
            };

            // Call with handler.
            renderer.RenderItemCheck += handler;
            renderer.DrawItemCheck(eventArgs);
            Assert.Equal(1, callCount);

            // Remove handler.
            renderer.RenderItemCheck -= handler;
            renderer.DrawItemCheck(eventArgs);
            Assert.Equal(1, callCount);
        }
Exemplo n.º 2
0
        public void ToolStripRenderer_DrawItemCheck_NullE_ThrowsArgumentNullException()
        {
            var renderer = new SubToolStripRenderer();

            Assert.Throws <ArgumentNullException>("e", () => renderer.DrawItemCheck(null));
        }