Ejemplo n.º 1
0
        public void ShouldSearchAndReplaceTagNames()
        {
            // Arrange
            var tags = new Dictionary <string, string>()
            {
            };

            var(documentPath, _, _) = GetDocumentsCharacteristic().First(d => d.Item2 == 0);
            string actualDocumentContent;

            // Act
            using (var document = new OpenXmlDocument(documentPath))
            {
                document.SearchAndReplaceTags(tags);
                actualDocumentContent = document.GetContent();
            }

            // Assert
            Assert.Contains("Lorem ipsum dolor sit amet", actualDocumentContent);
            Assert.Contains("Proin blandit porta mauris nec convallis", actualDocumentContent);
        }
Ejemplo n.º 2
0
        public void ShouldSearchAndReplaceTagNamesFromFilePath(string documentPath)
        {
            // Arrange
            var tags = new Dictionary <string, string>()
            {
                { "Title", "Lorem ipsum dolor sit amet" },
                { "Subtitle", "Proin blandit porta mauris nec convallis" }
            };
            string actualDocumentContent;

            // Act
            using (var document = new OpenXmlDocument(documentPath))
            {
                document.SearchAndReplaceTags(tags);
                actualDocumentContent = document.GetContent();
            }

            // Assert
            Assert.Contains("Lorem ipsum dolor sit amet", actualDocumentContent);
            Assert.Contains("Proin blandit porta mauris nec convallis", actualDocumentContent);
        }