Exemple #1
0
        public void ErrorProvider_Dispose_InvokeBoolMultipleTimesDefault_Nop(bool disposing)
        {
            var provider = new SubErrorProvider();

            provider.Dispose(disposing);
            Assert.NotNull(provider.Icon);

            provider.Dispose(disposing);
            Assert.NotNull(provider.Icon);
        }
Exemple #2
0
        public void ErrorProvider_Dispose_InvokeBoolWithItems_ClearsIfDisposing(bool disposing, string expectedError)
        {
            var provider = new SubErrorProvider();
            var control  = new Control();

            provider.SetError(control, "error");
            Assert.Equal("error", provider.GetError(control));

            provider.Dispose(disposing);
            Assert.NotNull(provider.Icon);
            Assert.Equal(expectedError, provider.GetError(control));

            provider.Dispose(disposing);
            Assert.NotNull(provider.Icon);
            Assert.Equal(expectedError, provider.GetError(control));
        }
Exemple #3
0
        public void ErrorProvider_Ctor_Default()
        {
            var provider = new SubErrorProvider();

            Assert.Equal(250, provider.BlinkRate);
            Assert.Equal(ErrorBlinkStyle.BlinkIfDifferentError, provider.BlinkStyle);
            Assert.True(provider.CanRaiseEvents);
            Assert.Null(provider.Container);
            Assert.Null(provider.ContainerControl);
            Assert.Null(provider.DataMember);
            Assert.Null(provider.DataSource);
            Assert.False(provider.DesignMode);
            Assert.NotNull(provider.Events);
            Assert.Same(provider.Events, provider.Events);
            Assert.NotNull(provider.Icon);
            Assert.Same(provider.Icon, provider.Icon);
            Assert.Null(provider.Site);
            Assert.Null(provider.Tag);
        }
Exemple #4
0
        public void ErrorProvider_OnRightToLeftChanged_Invoke_CallsRightToLeftChanged(EventArgs eventArgs)
        {
            var          provider  = new SubErrorProvider();
            int          callCount = 0;
            EventHandler handler   = (sender, e) =>
            {
                Assert.Same(provider, sender);
                Assert.Same(eventArgs, e);
                callCount++;
            };

            // Call with handler.
            provider.RightToLeftChanged += handler;
            provider.OnRightToLeftChanged(eventArgs);
            Assert.Equal(1, callCount);

            // Remove handler.
            provider.RightToLeftChanged -= handler;
            provider.OnRightToLeftChanged(eventArgs);
            Assert.Equal(1, callCount);
        }