Example #1
0
        public void ProcessLayoutString_NonServerControlColsOutAndEnsureSfCols_DivIsServerControlAndWrapped()
        {
            //Arrange
            var layoutControl = new DummyGridControl();

            //Act
            var result = layoutControl.PublicProcessLayoutString(@"<div class=""sf_colsOut""></div>", ensureSfColsWrapper: true);

            //Assert
            Assert.AreEqual(@"<div runat=""server"" class=""sf_cols""><div class=""sf_colsOut"" runat=""server""></div></div>", result, "Sf_cols wrapper div is not added added.");
        }
Example #2
0
        public void ProcessLayoutString_NonServerControlColsIn_DivIsServerControl()
        {
            //Arrange
            var layoutControl = new DummyGridControl();

            //Act
            var result = layoutControl.PublicProcessLayoutString(@"<div class=""sf_colsIn""></div>", ensureSfColsWrapper: false);

            //Assert
            Assert.AreEqual(@"<div class=""sf_colsIn"" runat=""server""></div>", result, "Server tag is not appended correctly.");
        }
Example #3
0
        public void PrecessLayoutString_ServerControlColsOut_ReturnsUnchangedTemplate()
        {
            //Arrange
            var layoutControl = new DummyGridControl();
            var template = @"<div class=""sf_colsOut"" runat=""server""></div>";

            //Act
            var result = layoutControl.PublicProcessLayoutString(template, ensureSfColsWrapper: false);

            //Assert
            Assert.AreEqual(template, result, "The template is not preserved.");
        }
Example #4
0
        public void GetAttributeValue_GetTheValueOfTheClassAttribute_VerifyTheMethodReturnsTheProperAttributeValue()
        {
            //Arrange: Initialize the GridControl, create a fake HTML template with attributes
            var layoutControl = new DummyGridControl();
            string expectedAttributeValue = "sf_colsOut";
            string actualAttributeValue = string.Empty;
            string attributeName = "class";
            var template = string.Format(@"<div {0}=""{1}"" runat=""server""></div>", attributeName, expectedAttributeValue);

            //Act: parse the HTML template and then get the value of the class attribute
            using (HtmlParser parser = new HtmlParser(template))
            {
                parser.SetChunkHashMode(false);
                parser.AutoExtractBetweenTagsOnly = false;
                parser.CompressWhiteSpaceBeforeTag = false;
                parser.KeepRawHTML = true;
                HtmlChunk chunk = parser.ParseNext();
                actualAttributeValue = layoutControl.PublicGetAttributeValue(chunk, attributeName);
            }

            //Assert: Verify the GetAttributeValue of the GridControl class is returning the correct attribute value
            Assert.AreEqual(expectedAttributeValue, actualAttributeValue, "The attribute value returned by the GetAttributeValue method is not correct.");
        }