public void SerializeTsStringToXml_WithExternalLink() { ITsPropsBldr tpb = TsStringUtils.MakePropsBldr(); tpb.SetIntValue(FwTextPropType.ktptWs, FwTextPropVar.ktpvDefault, EnWS); tpb.SetStringValue(FwTextPropType.ktptObjData, CreateObjData(FwObjDataTypes.kodtExternalPathName, "C:\\Idont\\exist\\here.doc")); ITsString tss = TsStringUtils.MakeString("document", tpb.GetTextProps()); string xml = TsStringSerializer.SerializeTsStringToXml(tss, WritingSystemManager); Assert.That(StripNewLines(xml), Is.EqualTo("<Str><Run ws=\"en\" externalLink=\"C:\\Idont\\exist\\here.doc\">document</Run></Str>")); }
public void SerializeTsStringToXml_WithEmbeddedData() { ITsPropsBldr tpb = TsStringUtils.MakePropsBldr(); tpb.SetIntValue(FwTextPropType.ktptWs, FwTextPropVar.ktpvDefault, EnWS); tpb.SetStringValue(FwTextPropType.ktptObjData, CreateObjData(FwObjDataTypes.kodtEmbeddedObjectData, "<FN><M>a</M></FN>")); ITsString tss = TsStringUtils.MakeString("a", tpb.GetTextProps()); string xml = TsStringSerializer.SerializeTsStringToXml(tss, WritingSystemManager); Assert.That(StripNewLines(xml), Is.EqualTo("<Str><Run ws=\"en\" embedded=\"<FN><M>a</M></FN>\">a</Run></Str>")); }
public void SerializeTsStringToXml_WithOwningLink() { Guid expectedGuid = Guid.NewGuid(); ITsPropsBldr tpb = TsStringUtils.MakePropsBldr(); tpb.SetIntValue(FwTextPropType.ktptWs, FwTextPropVar.ktpvDefault, EnWS); tpb.SetStringValue(FwTextPropType.ktptObjData, CreateObjData(FwObjDataTypes.kodtOwnNameGuidHot, expectedGuid.ToByteArray())); ITsString tss = TsStringUtils.MakeString(StringUtils.kChObject.ToString(), tpb.GetTextProps()); string xml = TsStringSerializer.SerializeTsStringToXml(tss, WritingSystemManager); Assert.That(StripNewLines(xml), Is.EqualTo(string.Format("<Str><Run ws=\"en\" ownlink=\"{0}\"></Run></Str>", expectedGuid))); }