Esempio n. 1
0
 public void CheckWhenRequired()
 {
     var tag = new If();
     try
     {
         RequiredAttribute.Check(tag);
         Assert.Fail("Expected exception");
     }
     catch (TagException Te)
     {
         Assert.That(Te.Message, Is.EqualTo(TagException.MissingRequiredAttribute(typeof (If), "Test").Message));
     }
     tag.Test = new MockAttribute(new Property("True"));
     RequiredAttribute.Check(tag);
 }
Esempio n. 2
0
 public void SimpleFalse()
 {
     var tag = new If();
     tag.Body = new MockAttribute(new Property("Body"));
     tag.Test = new MockAttribute(new Property("False"));
     Assert.That(tag.Evaluate(new TagModel(this)), Is.EqualTo(String.Empty));
 }
Esempio n. 3
0
        public void VariableTrueDifferentPageScope()
        {
            var session = new MockSessionState();
            var model = new TagModel(this, session);

            var tag = new If();
            tag.Body = new MockAttribute(new Property("Body"));
            tag.Test = new MockAttribute(new Property("True"));
            tag.Var = new MockAttribute(new Property("VarName"));
            tag.Scope = new MockAttribute(new Property("SessionScope"));
            Assert.That(tag.Evaluate(model), Is.EqualTo(String.Empty));
            Assert.That(model.Session[VarName], Is.EqualTo(Body));
        }
Esempio n. 4
0
 public void VariableTrue()
 {
     var model = new TagModel(this);
     var tag = new If();
     tag.Body = new MockAttribute(new Property("Body"));
     tag.Test = new MockAttribute(new Property("True"));
     tag.Var = new MockAttribute(new Property("VarName"));
     Assert.That(tag.Evaluate(model), Is.EqualTo(String.Empty));
     Assert.That(model[VarName], Is.EqualTo(Body));
 }