public void Paragraphs_Layout_Left()
        {
            var documentView = NodeTestExtensions.SetUp(Alignment.Start);

            documentView.Arrange(new Rectangle(10, 20, 200, 500));
            documentView.ExposedRootView.Count.Should().Be(2);
            documentView.ExposedRootView[0].ExtractFromChildren(v => v.LayoutRect.X).Should().BeEquivalentTo(10, 10, 10, 10, 10);
            documentView.ExposedRootView[1].ExtractFromChildren(v => v.LayoutRect.X).Should().BeEquivalentTo(10, 10, 10, 10, 10);
        }
        public void Paragraphs_Contain_Correct_Text()
        {
            var documentView = NodeTestExtensions.SetUp();

            documentView.Arrange(new Rectangle(10, 20, 200, 500));
            documentView.ExposedRootView.Count.Should().Be(2);
            documentView.ExposedRootView[0].Node.ExtractNodeText().Should().Be("Hello World, Here I am. Long text ahead here. This is the first paragraph.\n");
            documentView.ExposedRootView[1].Node.ExtractNodeText().Should().Be("After a line break, we should see a second paragraph in the document.");
        }
        public void Paragraphs_Layout_Right()
        {
            var documentView = NodeTestExtensions.SetUp(Alignment.End);

            documentView.Arrange(new Rectangle(10, 20, 200, 500));
            documentView.ExposedRootView.Count.Should().Be(2);
            documentView.ExposedRootView[0].ExtractFromChildren(v => v.LayoutRect.X).Should().BeEquivalentTo(12, 34, 23, 67, 89);
            documentView.ExposedRootView[0].ExtractFromChildren(v => v.LayoutRect.X + v.LayoutRect.Width).Should().BeEquivalentTo(210, 210, 210, 210, 210);
            documentView.ExposedRootView[1].ExtractFromChildren(v => v.LayoutRect.X).Should().BeEquivalentTo(67, 23, 67, 23, 111);
            documentView.ExposedRootView[1].ExtractFromChildren(v => v.LayoutRect.X + v.LayoutRect.Width).Should().BeEquivalentTo(210, 210, 210, 210, 210);
        }
        public void Paragraphs_Layout_Paragraphs()
        {
            var documentView = NodeTestExtensions.SetUp();

            documentView.Arrange(new Rectangle(10, 20, 200, 500));
            documentView.ExposedRootView.Count.Should().Be(2);
            documentView.ExposedRootView[0].LayoutRect.Should().Be(new Rectangle(10, 20, 200, 75));
            documentView.ExposedRootView[0].ExtractFromChildren(v => v.LayoutRect.Width).Should().BeEquivalentTo(198, 176, 187, 143, 121);
            documentView.ExposedRootView[1].LayoutRect.Should().Be(new Rectangle(10, 95, 200, 75));
            documentView.ExposedRootView[1].ExtractFromChildren(v => v.LayoutRect.Width).Should().BeEquivalentTo(143, 187, 143, 187, 99);
        }
        public void Paragraphs_Layout_Center()
        {
            var documentView = NodeTestExtensions.SetUp(Alignment.Center);

            documentView.Arrange(new Rectangle(10, 20, 200, 500));
            documentView.ExposedRootView.Count.Should().Be(2);
            documentView.ExposedRootView[0].ExtractFromChildren(v => v.LayoutRect.X).Should().BeEquivalentTo(11, 22, 16, 38, 49);
            documentView.ExposedRootView[0].ExtractFromChildren(v => v.LayoutRect.X + v.LayoutRect.Width).Should().BeEquivalentTo(209, 198, 203, 181, 170);
            documentView.ExposedRootView[1].ExtractFromChildren(v => v.LayoutRect.X).Should().BeEquivalentTo(38, 16, 38, 16, 60);
            documentView.ExposedRootView[1].ExtractFromChildren(v => v.LayoutRect.X + v.LayoutRect.Width).Should().BeEquivalentTo(181, 203, 181, 203, 159);
        }
        public void Navigation_Is_Not_allowed_on_Invalid_layout()
        {
            var       doc   = NodeTestExtensions.SetUp();
            var       chunk = doc.ExposedRootView;
            Rectangle rect;
            int       offset;
            Bias      bias;

            chunk.ModelToView(10, out rect).Should().Be(false, "View mapping operations are not allowed when the layout is not valid.");
            chunk.ViewToModel(new Point(10, 10), out offset, out bias).Should().Be(false, "View mapping operations are not allowed when the layout is not valid.");
            chunk.Navigate(10, Direction.Left, out offset).Should().Be(NavigationResult.Invalid);
        }
 TestDocumentView <PlainTextDocument> CreateView(string text = null)
 {
     return(NodeTestExtensions.SetUp(Alignment.Start, text ?? "Hello World, Here I am. \nLong text ahead here. \nA long word, that is impossible to break apart."));
 }