public void ContainerControl_OnFontChanged_InvokeWithAutoScaleModeFont_CallsFontChanged(EventArgs eventArgs) { var control = new SubContainerControl { AutoScaleMode = AutoScaleMode.Font }; int callCount = 0; EventHandler handler = (sender, e) => { Assert.Same(control, sender); Assert.Same(eventArgs, e); callCount++; }; // Call with handler. control.FontChanged += handler; control.OnFontChanged(eventArgs); Assert.Equal(new Size(1, 1), control.AutoScaleFactor); Assert.Equal(1, callCount); // Remove handler. control.FontChanged -= handler; control.OnFontChanged(eventArgs); Assert.Equal(new Size(1, 1), control.AutoScaleFactor); Assert.Equal(1, callCount); }
public void ContainerControl_OnFontChanged_Invoke_CallsFontChanged(EventArgs eventArgs) { var control = new SubContainerControl(); int callCount = 0; EventHandler handler = (sender, e) => { Assert.Same(control, sender); Assert.Same(eventArgs, e); callCount++; }; // Call with handler. control.FontChanged += handler; control.OnFontChanged(eventArgs); Assert.Equal(1, callCount); // Remove handler. control.FontChanged -= handler; control.OnFontChanged(eventArgs); Assert.Equal(1, callCount); }