Beispiel #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));
            }
        }
Beispiel #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));
                }
        }
Beispiel #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));
         }
 }