Example #1
0
        public void On_child_updated_the_render_operation_is_synchronized()
        {
            _terminal.Height     = 40;
            _terminal.Width      = 100;
            _terminal.CursorLeft = _terminal.CursorTop = 20;

            var screen = new ScreenView(_renderer, _terminal, _synchronizationContext);
            var view   = new TestView();

            screen.Child = view;

            //Simulate multiple concurrent updates
            view.RaiseUpdated();
            view.RaiseUpdated();
            _synchronizationContext.InvokePostCallbacks();

            _synchronizationContext.PostInvocationCount.Should().Be(1);
            view.RenderedRegions
            .Should()
            .BeEquivalentSequenceTo(new Region(0, 0, 100, 40));
        }