Esempio n. 1
0
        public void ReplaceSingleTagWithTextBlocksDoesNothing()
        {
            using (var initialDocument = new DocxDocument(Resources.WithMainContentSingleTag))
            {
                var content = new[] { new TextBlock("Контент документа") };
                initialDocument.Replace("MAIN_CONTENT", content);

                Assert.IsTrue(new DocxDocumentEqualityComparer().Equals(initialDocument, initialDocument));
            }
        }
Esempio n. 2
0
        public void ReplaceOpenCloseTagWithTextBlocksEditable()
        {
            using (var initialDocument = new DocxDocument(Resources.WithMainContentTag))
                using (var expectedDocument = new DocxDocument(Resources.WithMainContentInserted))
                {
                    var content = new[] { new TextBlock("Контент документа") };
                    initialDocument.Replace("MAIN_CONTENT", content);

                    Assert.IsTrue(new DocxDocumentEqualityComparer().Equals(expectedDocument, initialDocument));
                }
        }
Esempio n. 3
0
 public void ReplacePairsFromDictionary()
 {
     using (var initialDocument = new DocxDocument(Resources.DocumentWithTitle))
         using (var expectedDocument = new DocxDocument(Resources.DocumentWithReplacedTitle))
         {
             initialDocument.Replace(new Dictionary <string, string>
             {
                 { "Title", "Hello" }
             });
             Assert.IsTrue(new DocxDocumentEqualityComparer().Equals(expectedDocument, initialDocument));
         }
 }