public void Add_1() { var t1 = new InlineTag(Tag.S, "id", "rid", "name", "ctype", "display", "code"); var t2 = new InlineTag(Tag.S, "ID", "RID", "NAME", "CTYPE", "DISPLAY", "CODE"); var s = new InlineBuilder(); s.Is(); s.Add(""); s.Is(); s.Add("abc"); s.Is("abc"); s.Add("def"); s.Is("abcdef"); s.Add(""); s.Is("abcdef"); s.Add(t1); s.Is("abcdef", t1); s.Add(""); s.Is("abcdef", t1); s.Add(t2); s.Is("abcdef", t1, t2); s.Add(""); s.Is("abcdef", t1, t2); s.Add("xyz"); s.Is("abcdef", t1, t2, "xyz"); }
public void Reset_1() { var b = new InlineBuilder(); b.IsEmpty.IsTrue(); b.Add("abc"); b.IsEmpty.IsFalse(); b.Clear(); b.IsEmpty.IsTrue(); b.Add("def"); b.IsEmpty.IsFalse(); b.Clear(true); b.IsEmpty.IsTrue(); }
public void Add_2() { var s = new InlineBuilder(); s.Is(); s.Add(Ins); s.Is(); s.Add("abc"); s.Is(Ins_("abc")); s.Add(Emp); s.Is(Ins_("abc")); s.Add(Del); s.Is(Ins_("abc")); s.Add("def"); s.Is(Ins_("abc"), Del_("def")); }
public void Property_2() { var b = new InlineBuilder(); b.Property.Is(None); b.Add("abc"); b.Property.Is(None); b.Property = Ins; b.Property.Is(Ins); b.Add("def"); b.Property.Is(Ins); b.Property = Del; b.Property.Is(Del); b.Add("ghi"); b.Property.Is(Del); b.Is("abc", Ins_("def"), Del_("ghi")); }
public void Add_3() { var t1 = new InlineTag(Tag.S, "id", "rid", "name", "ctype", "display", "code"); var t2 = new InlineTag(Tag.S, "ID", "RID", "NAME", "CTYPE", "DISPLAY", "CODE"); var s = new InlineBuilder(); s.Is(); s.Add(Ins); s.Is(); s.Add(t1); s.Is(Ins_(t1)); s.Add(Emp); s.Is(Ins_(t1)); s.Add(Del); s.Is(Ins_(t1)); s.Add(t2); s.Is(Ins_(t1), Del_(t2)); }
public void Add_Tag_Exception() { { var b = new InlineBuilder(); AssertEx.Catch <ArgumentNullException>(() => b.Add(Tag.S, null, "rid", "name")); } { var b = new InlineBuilder(); AssertEx.Catch <ArgumentNullException>(() => b.Add(Tag.S, "id", null, "name")); } { var b = new InlineBuilder(); AssertEx.Catch <ArgumentNullException>(() => b.Add(Tag.S, "id", "rid", null)); } }
/// <summary> /// Parse an XML fragment representing a source/target content into <see cref="InlineString"/>. /// </summary> /// <param name="text"></param> /// <returns></returns> protected static InlineString GetInlineString(string text) { var inline = new InlineBuilder(); foreach (var elem in XElement.Parse(text).Elements("Elements").Elements()) { switch (elem.Name.LocalName) { case "Text": inline.Add((string)elem.Element("Value") ?? ""); break; case "Tag": inline.Add(GetInlineTag(elem)); break; default: // Just in case... inline.Add(new InlineTag(Tag.S, "*", "", elem.Name.LocalName, null, null, elem.ToString())); break; } } return(inline.ToInlineString()); }
public void Property_3() { var b = new InlineBuilder(); b.Property = Ins; b.Add("abc"); b.Add("def"); b.Property = Del; b.Add("ghi"); b.Property = Del; b.Add("jkl"); b.Property = Emp; b.Add("mno"); b.Property = Ins; b.Property = Emp; b.Add("pqr"); b.Is(Ins_("abcdef"), Del_("ghijkl"), Emp_("mnopqr")); }