Esempio n. 1
0
 public void CheckWhenRequired()
 {
     var tag = new InsertTemplate();
     try
     {
         RequiredAttribute.Check(tag);
         Assert.Fail("Expected exception");
     }
     catch (TagException Te)
     {
         Assert.That(Te.Message,
                     Is.EqualTo(
                         TagException.MissingRequiredAttribute(typeof (InsertTemplate), "Template").Message));
     }
     tag.Factory=new FileLocatorFactory().CloneForTagLib(new TagLib().Register(new Tags.Tiles()));
     tag.Template = new MockAttribute(new Property("tiles"));
     RequiredAttribute.Check(tag);
 }
Esempio n. 2
0
 public void InsertTemplateWithUrlAttribute()
 {
     var tag = new InsertTemplate()
                   {
                       Template = new MockAttribute(new Constant("insertDMaster.htm"))
                   };
     tag.Factory = _factory;
     var moduleAttribute = new PutAttribute()
                               {
                                   Name = new MockAttribute(new Constant("modules")),
                                   Value = new MockAttribute(new Constant("insertDAdditional.htm"))
                               };
     tag.AddNestedTag(moduleAttribute);
     var bodyAttribute = new PutAttribute()
                             {
                                 Name = new MockAttribute(new Constant("body")),
                                 Value = new MockAttribute(new Constant("Dit is de Test Body"))
                             };
     tag.AddNestedTag(bodyAttribute);
     string expected = (new StreamReader("insertDExpected.htm")).ReadToEnd();
     string value = tag.Evaluate(_model);
     Assert.That(value, Is.EqualTo(expected));
 }
Esempio n. 3
0
 public void InsertTemplateWithOneSimpleAttribute()
 {
     var tag = new InsertTemplate()
                   {
                       Template = new MockAttribute(new Constant("insertBMaster.htm"))
                   };
     tag.Factory = _factory;
     var titleAttribute = new PutAttribute()
                              {
                                  Name = new MockAttribute(new Constant("title")),
                                  Value = new MockAttribute(new Constant("Dit is de Test Title"))
                              };
     tag.AddNestedTag(titleAttribute);
     string expected = (new StreamReader("insertBExpected.htm")).ReadToEnd();
     string value = tag.Evaluate(_model);
     Assert.That(value, Is.EqualTo(expected));
 }
Esempio n. 4
0
 public void InsertTemplateWithIllegalAttribute()
 {
     var tag = new InsertTemplate()
                   {
                       Template = new MockAttribute(new Constant("insertEMaster.htm"))
                   };
     tag.Factory = _factory;
     var setAttribute = new Set
                            {
                                Var = new MockAttribute(new Constant("body")),
                                Body = new MockAttribute(new Constant("Dit is de Test Body"))
                            };
     try
     {
         tag.AddNestedTag(setAttribute);
         string expected = (new StreamReader("insertEExpected.htm")).ReadToEnd();
         tag.Evaluate(_model);
         Assert.Fail("Expect exception");
     }
     catch (TagException Te)
     {
         Assert.That(Te.Message,
                     Is.EqualTo(
                         TagException.OnlyNestedTagsOfTypeAllowed(setAttribute.GetType(), typeof (PutAttribute)).
                             Message));
     }
 }
Esempio n. 5
0
 public void InsertTemplateCachesTile()
 {
     var tag = new InsertTemplate()
     {
         Template = new MockAttribute(new Constant("insertEMaster.htm"))
     };
     tag.Factory = _factory;
     var bodyAttribute = new PutAttribute()
     {
         Name = new MockAttribute(new Constant("body")),
         Body = new MockAttribute(new Constant("Dit is de Test Body"))
     };
     tag.AddNestedTag(bodyAttribute);
     tag.Evaluate(_model);
     var tile = tag.Tile;
     tag.Evaluate(_model);
     Assert.That(tag.Tile, Is.SameAs(tile));
 }
Esempio n. 6
0
 public void InsertTemplate()
 {
     var tag = new InsertTemplate()
                   {
                       Template = new MockAttribute(new Constant("insertAMaster.htm"))
                   };
     tag.Factory = _factory;
     string expected = (new StreamReader("insertAExpected.htm")).ReadToEnd();
     string value = tag.Evaluate(_model);
     Assert.That(value, Is.EqualTo(expected));
 }