Beispiel #1
0
        public void ToolStripRenderer_DrawStatusStripSizingGrip_Invoke_CallsRenderStatusStripSizingGrip(ToolStrip toolStrip)
        {
            using var image         = new Bitmap(10, 10);
            using Graphics graphics = Graphics.FromImage(image);
            var eventArgs = new ToolStripRenderEventArgs(graphics, toolStrip);

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

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

            // Remove handler.
            renderer.RenderStatusStripSizingGrip -= handler;
            renderer.DrawStatusStripSizingGrip(eventArgs);
            Assert.Equal(1, callCount);
        }
Beispiel #2
0
        public void DrawStatusStripSizingGrip_NullE_ThrowsArgumentNullException()
        {
            var renderer = new SubToolStripRenderer();

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