public void SetUp() { _lib = new TagLib(); _lib.Register(new Tags.Tiles()); _lib.Register(new Sharp()); _factory = new FileLocatorFactory().CloneForTagLib(_lib) as FileLocatorFactory; new TilesSet(); _map = new TilesMap(); _data = new Hashtable(); _model = new TagModel(_data); _nestedAttributes = new AttributeSet( "nested", new TileAttribute("aAttribute", new StringTile("aAttributeValue")) ); _map.AddTile(new TemplateTile("fileWithAttributes", _factory.Handle("filewithtileattributes.htm", true), _nestedAttributes)); _attributes = new AttributeSet( "main", new TileAttribute("simple", new StringTile("simpleValue")), new TileAttribute("file", new TemplateTile(null, _factory.Handle("a.htm", true), null)), new TileAttribute("fileWithVars", new TemplateTile(null, _factory.Handle("b.htm", true), null)), new TileAttribute("fileWithTilesAttributes", new TileReference("fileWithAttributes", _map)) ); _model.Decorate().With(_attributes); _data["simpleAsProperty"] = "simple"; _data["some"] = new Hashtable { { "a", "AA" } }; }
public string Render(TagModel model, AttributeSet attributes) { try { using (model.Decorate().With(attributes)) { return(_template.Evaluate(model)); } } catch (TileExceptionWithContext) { throw; } catch (TileException) { throw; } catch (ExceptionWithContext EWC) { throw TileExceptionWithContext.ErrorInTile(_template.Description, EWC); } catch (Exception e) { throw TileException.ErrorInTile(_template.Description, e); } }