Exemplo n.º 1
0
 public void BadTag()
 {
     var tag = new Choose();
     var outTag = new Out();
     try
     {
         tag.AddNestedTag(outTag);
     }
     catch (TagException Te)
     {
         Assert.AreEqual(Te.Message,
                         TagException.OnlyNestedTagsOfTypeAllowed(typeof (Out), typeof (When), typeof (When)));
     }
 }
Exemplo n.º 2
0
 public void CheckRequired()
 {
     var tag = new Choose();
     RequiredAttribute.Check(tag);
 }
Exemplo n.º 3
0
 public void ChooseTwoFalseAndOtherWise()
 {
     var tag = new Choose();
     var whenFalse = new When();
     whenFalse.Body = new MockAttribute(new Constant("Body1"));
     whenFalse.Select = new MockAttribute(new Constant("/results/value[position()=2]"));
     whenFalse.Source = new MockAttribute(new Constant("xml"));
     tag.AddNestedTag(whenFalse);
     var whenFalse2 = new When();
     whenFalse2.Body = new MockAttribute(new Constant("Body2"));
     whenFalse2.Select = new MockAttribute(new Constant("/results/value[position()=2]"));
     whenFalse2.Source = new MockAttribute(new Constant("xml"));
     tag.AddNestedTag(whenFalse2);
     var otherwise = new Otherwise();
     otherwise.Body = new MockAttribute(new Constant("Body3"));
     tag.AddNestedTag(otherwise);
     Assert.That(tag.Evaluate(_model), Is.EqualTo("Body3"));
 }
Exemplo n.º 4
0
 public void ChooseThreeTrueAndOtherWise()
 {
     var tag = new Choose();
     var whenTrue = new When();
     whenTrue.Body = new MockAttribute(new Constant("True1"));
     whenTrue.Select = new MockAttribute(new Constant("/results/value[position()=1]"));
     whenTrue.Source = new MockAttribute(new Constant("xml"));
     tag.AddNestedTag(whenTrue);
     var whenTrue2 = new When();
     whenTrue2.Body = new MockAttribute(new Constant("True2"));
     whenTrue2.Select = new MockAttribute(new Constant("/results/value[position()=1]"));
     whenTrue2.Source = new MockAttribute(new Constant("xml"));
     tag.AddNestedTag(whenTrue2);
     var whenTrue3 = new When();
     whenTrue3.Body = new MockAttribute(new Constant("True3"));
     whenTrue3.Select = new MockAttribute(new Constant("/results/value[position()=1]"));
     whenTrue3.Source = new MockAttribute(new Constant("xml"));
     tag.AddNestedTag(whenTrue2);
     var otherwise = new Otherwise();
     otherwise.Body = new MockAttribute(new Constant("Ötherwise"));
     tag.AddNestedTag(otherwise);
     Assert.That(tag.Evaluate(_model), Is.EqualTo("True1"));
 }
Exemplo n.º 5
0
 public void ChooseOnlyOtherwise()
 {
     var tag = new Choose();
     var otherwise = new Otherwise();
     otherwise.Body = new MockAttribute(new Constant("Body1"));
     tag.AddNestedTag(otherwise);
     Assert.That(tag.Evaluate(_model), Is.EqualTo("Body1"));
 }
Exemplo n.º 6
0
 public void ChooseOnlyOneWhenTrue()
 {
     var tag = new Choose();
     var whenTrue = new When();
     whenTrue.Body = new MockAttribute(new Constant("Body1"));
     whenTrue.Select = new MockAttribute(new Constant("/results/value[position()=1]"));
     whenTrue.Source = new MockAttribute(new Constant("xml"));
     tag.AddNestedTag(whenTrue);
     Assert.That(tag.Evaluate(_model), Is.EqualTo("Body1"));
 }