Example #1
0
        public void ByteViewer_SetStartLine_InvokeWithBytesWithHandle_Success(byte[] bytes, int line)
        {
            using var control = new ByteViewer();
            control.SetBytes(bytes);
            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.SetStartLine(line);
            Assert.True(control.IsHandleCreated);
            Assert.Equal(0, invalidatedCallCount);
            Assert.Equal(0, styleChangedCallCount);
            Assert.Equal(0, createdCallCount);

            // Call again.
            control.SetStartLine(line);
            Assert.True(control.IsHandleCreated);
            Assert.Equal(0, invalidatedCallCount);
            Assert.Equal(0, styleChangedCallCount);
            Assert.Equal(0, createdCallCount);
        }
Example #2
0
        public void ByteViewer_SetStartLine_InvokeNoBytes_Success(int line)
        {
            using var control = new ByteViewer();
            control.SetStartLine(line);
            Assert.False(control.IsHandleCreated);

            // Call again.
            control.SetStartLine(line);
            Assert.False(control.IsHandleCreated);
        }