Пример #1
0
        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>"));
        }
Пример #2
0
        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=\"&lt;FN&gt;&lt;M&gt;a&lt;/M&gt;&lt;/FN&gt;\">a</Run></Str>"));
        }
Пример #3
0
        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)));
        }