Exemple #1
0
        public void Execute_InsertParagraphCommand_WithSettedPosition_ShouldInsertParagraph()
        {
            var documentItems = new List <DocumentItem>()
            {
                new DocumentItem(new TestParagraph()),
                new DocumentItem(new TestParagraph())
            };
            var paragraph = new TestParagraph();
            var command   = new InsertParagraphCommand(documentItems, paragraph, 1);

            command.Execute();
            Assert.AreEqual(paragraph, documentItems[1].Paragraph);
        }
Exemple #2
0
        public void Unexecute_InsertParagraphCommand_WithEndPosition_ShouldInsertParagraph()
        {
            var previousParagraph = new TestParagraph();
            var documentItems     = new List <DocumentItem>()
            {
                new DocumentItem(previousParagraph)
            };
            var paragraph = new TestParagraph();
            var command   = new InsertParagraphCommand(documentItems, paragraph, null);

            command.Execute();
            Assert.AreEqual(paragraph, documentItems[1].Paragraph);

            command.Unexecute();
            Assert.AreEqual(previousParagraph, documentItems[0].Paragraph);
        }