Пример #1
0
 public void TestParseAndEvaluationOfNotNestedTagWhenNoneExpected()
 {
     try
     {
         Base().Parse("<c:remove var=\"text\"><c:remove var=\"text\"/></c:remove>");
         Assert.Fail("Expected exception");
     }
     catch (TagException Te)
     {
         Assert.That(Te.MessageWithOutContext, Is.EqualTo(TagException.ExpectedCloseTag(typeof(Remove)).Message));
     }
 }
        private static void GuardClosingOfTag(ITag close, ITag open)
        {
            if (close.State != TagState.Closed)
            {
                throw TagException.ExpectedCloseTag(open.GetType()).Decorate(close.Context);
            }

            if (!Equals(close.GetType(), open.GetType()))
            {
                if (Equals(close.Group.Name, open.Group.Name) &&
                    Equals(close.TagName, open.TagName))
                {
                    return;                                         //edge case. Close of nested tag with same name as parent tag
                }
                throw TagException.UnbalancedCloseingTag(open, close).Decorate(open.Context);
            }
        }