Beispiel #1
0
        public void ResolveFunctionToken_MultipleOccurencesTest()
        {
            // Arrange
            var funcProc = new PublishingFunctionProcessor(null, null, null, null, null, null);
            // use nothing other than the token as the input function

            var templateString = "A='{0}';B='{1}';C='{2}'";

            // enter the token value in a multitude of formats
            string inputFunctionString = string.Format(templateString,
                                                       funcProc.NameAttributeToken,
                                                       funcProc.NameAttributeToken.ToUpper(),
                                                       funcProc.NameAttributeToken.ToLower());

            // get our expected output .. where all tokens are resolved to our "property name"
            string expectedOutput = string.Format(templateString,
                                                  ExpectedPropertyName, ExpectedPropertyName, ExpectedPropertyName);


            // Act
            // do our token resolution
            string newFunction = funcProc.ResolveFunctionToken(inputFunctionString, ExpectedPropertyName);

            // Assert
            // check the processed string matches our expected output
            Assert.AreEqual(expectedOutput, newFunction);
        }
Beispiel #2
0
 /// <summary>
 /// Instantiates a publishing page object
 /// </summary>
 /// <param name="page">ListItem holding the page to analyze</param>
 /// <param name="pageTransformation">Page transformation information</param>
 public PublishingPage(ListItem page, PageTransformation pageTransformation, PublishingPageTransformation publishingPageTransformation, BaseTransformationInformation baseTransformationInformation, ClientContext targetContext = null, IList <ILogObserver> logObservers = null) : base(page, null, pageTransformation, logObservers)
 {
     this.publishingPageTransformation  = publishingPageTransformation;
     this.baseTransformationInformation = baseTransformationInformation;
     this.targetContext     = targetContext;
     this.functionProcessor = new PublishingFunctionProcessor(page, cc, targetContext, this.publishingPageTransformation, baseTransformationInformation, base.RegisteredLogObservers);
 }
Beispiel #3
0
 /// <summary>
 /// Instantiates a publishing page object
 /// </summary>
 /// <param name="page">ListItem holding the page to analyze</param>
 /// <param name="pageTransformation">Page transformation information</param>
 public PublishingPage(ListItem page, PageTransformation pageTransformation, BaseTransformationInformation baseTransformationInformation, IList <ILogObserver> logObservers = null) : base(page, null, pageTransformation, logObservers)
 {
     // no PublishingPageTransformation specified, fall back to default
     this.publishingPageTransformation  = new PageLayoutManager(base.RegisteredLogObservers).LoadDefaultPageLayoutMappingFile();
     this.baseTransformationInformation = baseTransformationInformation;
     this.functionProcessor             = new PublishingFunctionProcessor(page, cc, null, this.publishingPageTransformation, baseTransformationInformation, base.RegisteredLogObservers);
 }
Beispiel #4
0
        public void ResolveFunctionToken_SimpleReplacementTest()
        {
            // Arrange
            var funcProc = new PublishingFunctionProcessor(null, null, null, null, null, null);
            // use nothing other than the token as the input function
            string functionString = funcProc.NameAttributeToken;

            // Act
            string newFunction = funcProc.ResolveFunctionToken(functionString, ExpectedPropertyName);

            // Assert
            Assert.AreEqual(ExpectedPropertyName, newFunction);
        }
Beispiel #5
0
        public void ResolveFunctionToken_WithoutTokens()
        {
            // Arrange
            var funcProc = new PublishingFunctionProcessor(null, null, null, null, null, null);
            // use nothing other than the token as the input function

            var functionString = "A='foo'";

            // Act
            // if this throws any exceptions the test will fail
            string newFunction = funcProc.ResolveFunctionToken(functionString, ExpectedPropertyName);

            // Assert
            // make sure it hasn't changed
            Assert.AreEqual(functionString, newFunction);
        }
Beispiel #6
0
        public void ResolveFunctionToken_CaseSensitivityTest()
        {
            // Arrange
            var funcProc = new PublishingFunctionProcessor(null, null, null, null, null, null);
            // use nothing other than the token as the input function
            string functionStringLower = funcProc.NameAttributeToken.ToLower();
            string functionStringUpper = funcProc.NameAttributeToken.ToUpper();

            // Act
            string newFunctionLower = funcProc.ResolveFunctionToken(functionStringLower, ExpectedPropertyName);
            string newFunctionUpper = funcProc.ResolveFunctionToken(functionStringUpper, ExpectedPropertyName);

            // Assert
            Assert.AreEqual(ExpectedPropertyName, newFunctionLower);
            Assert.AreEqual(ExpectedPropertyName, newFunctionUpper);
        }
 /// <summary>
 /// Instantiates a publishing page object
 /// </summary>
 /// <param name="page">ListItem holding the page to analyze</param>
 /// <param name="pageTransformation">Page transformation information</param>
 public PublishingPage(ListItem page, PageTransformation pageTransformation, PublishingPageTransformation publishingPageTransformation, IList <ILogObserver> logObservers = null) : base(page, pageTransformation, logObservers)
 {
     this.publishingPageTransformation = publishingPageTransformation;
     this.functionProcessor            = new PublishingFunctionProcessor(page, cc, null, this.publishingPageTransformation, base.RegisteredLogObservers);
 }