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.Equal(expectedDocument, initialDocument, new DocxDocumentEqualityComparer()); } }
public void ReplaceSingleTagWithTextBlocksDoesNothing() { using (var initialDocument = new DocxDocument(Resources.WithMainContentSingleTag)) { var content = new[] { new TextBlock("Контент документа") }; initialDocument.Replace("MAIN_CONTENT", content); Assert.Equal(initialDocument, initialDocument, new DocxDocumentEqualityComparer()); } }
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.Equal(expectedDocument, initialDocument, new DocxDocumentEqualityComparer()); } }