Example #1
0
        public void DrawinInhiibited_DependingOnVisibility()
        {
            var api = new StubbedNativeCalls();

            using var controller = new StubbedConsoleController();
            using var sut        = new ConControls.Controls.ConsoleWindow(api, controller, new StubbedGraphicsProvider());

            sut.DrawingInhibited.Should().BeFalse();
            using (sut.DeferDrawing())
                sut.DrawingInhibited.Should().BeTrue();
            sut.DrawingInhibited.Should().BeFalse();
            sut.Dispose();
            sut.DrawingInhibited.Should().BeTrue();
        }
Example #2
0
        public void Draw_NotDrawnWhenInhibited()
        {
            var api = new StubbedNativeCalls();

            using var controller = new StubbedConsoleController();
            var  graphicsProvider = new StubbedGraphicsProvider();
            bool provided         = false;

            graphicsProvider.ProvideConsoleOutputHandleINativeCallsSizeFrameCharSets = (handle, calls, arg3, arg4) =>
            {
                provided = true;
                return(graphicsProvider.Graphics);
            };

            using var sut = new ConControls.Controls.ConsoleWindow(api, controller, graphicsProvider);
            provided      = false;
            using (sut.DeferDrawing())
            {
                sut.Invalidate();
                provided.Should().BeFalse();
            }

            provided.Should().BeTrue();
        }