예제 #1
0
 /// <summary>
 /// Make one (read-write).
 /// </summary>
 /// <param name="obj"></param>
 /// <param name="flid"></param>
 /// <param name="reader"></param>
 /// <param name="writer"></param>
 public VirtualStringAccessor(ICmObject obj, int flid, AlternativeReader reader, AlternativeWriter writer) : this(obj, flid, reader)
 {
     Debug.Assert(writer != null);
     m_writer = writer;
 }
 public virtual void testAlternativeWriter()
 {
 StringBuilder buf = new StringBuilder();
 IStringTemplateWriter w = new AlternativeWriter(buf);
 StringTemplateGroup group = new StringTemplateGroup("test");
 group.DefineTemplate("bold", "<b>$x$</b>");
 StringTemplate name = new StringTemplate(group, "$name:bold(x=name)$");
 name.SetAttribute("name", "Terence");
 name.Write(w);
 Assert.AreEqual(buf.ToString(), "<b>Terence</b>");
 }