Beispiel #1
0
        public void Break_BreaksIntoTwo(string whole, int splitIndex, string left, string right)
        {
            var it = DoAll(new Func <UndoableAction>[]
            {
                FromCommand <InsertTextCommand, string>(() => BlockAt(0).EndCursor().ToHandle(), whole),
                FromCommand <BreakTextBlockCommand>(() => BlockAt(0).BeginCursor(splitIndex).ToHandle()),
            });

            DidYouKnow.That(Document.Root.ChildCount).Should().Be(2);
            DidYouKnow.That(BlockAt(0)).Should().BeAssignableTo <TextBlock>();
            DidYouKnow.That(BlockAt(1)).Should().BeAssignableTo <TextBlock>();

            DidYouKnow.That(BlockAt(0).As <TextBlock>().AsText()).Should().Be(left);
            DidYouKnow.That(BlockAt(1).As <TextBlock>().AsText()).Should().Be(right);

            it.VerifyUndo();
        }