Пример #1
0
        public void ByteViewer_ScrollChanged_InvokeWithHandle_Success(object source, EventArgs e)
        {
            using var control = new SubByteViewer();
            Assert.NotEqual(IntPtr.Zero, control.Handle);
            int invalidatedCallCount = 0;

            control.Invalidated += (sender, e) => invalidatedCallCount++;
            int styleChangedCallCount = 0;

            control.StyleChanged += (sender, e) => styleChangedCallCount++;
            int createdCallCount = 0;

            control.HandleCreated += (sender, e) => createdCallCount++;

            control.ScrollChanged(source, e);
            Assert.True(control.IsHandleCreated);
            Assert.Equal(1, invalidatedCallCount);
            Assert.Equal(0, styleChangedCallCount);
            Assert.Equal(0, createdCallCount);

            // Call again.
            control.ScrollChanged(source, e);
            Assert.True(control.IsHandleCreated);
            Assert.Equal(2, invalidatedCallCount);
            Assert.Equal(0, styleChangedCallCount);
            Assert.Equal(0, createdCallCount);
        }
Пример #2
0
        public void ByteViewer_ScrollChanged_Invoke_Success(object source, EventArgs e)
        {
            using var control = new SubByteViewer();
            control.ScrollChanged(source, e);
            Assert.False(control.IsHandleCreated);

            // Call again.
            control.ScrollChanged(source, e);
            Assert.False(control.IsHandleCreated);
        }