Пример #1
0
 public void DeserializeTsStringFromXml_NoWsInRun()
 {
     Assert.That(() => TsStringSerializer.DeserializeTsStringFromXml(
                     "<Str><Run>This is a test!</Run></Str>", WritingSystemManager),
                 Throws.TypeOf <XmlSchemaException>().With.Message.EqualTo(
                     "Run element must contain a ws attribute. Run text: This is a test!"));
 }
Пример #2
0
 public void DeserializeTsStringFromXml_MultiStringWithStyleAndNoWsInRun()
 {
     Assert.That(() => TsStringSerializer.DeserializeTsStringFromXml(
                     "<AStr ws='en'><Run namedStyle='Monkey'>This is a test!</Run></AStr>",
                     WritingSystemManager),
                 Throws.TypeOf <XmlSchemaException>().With.Message.EqualTo(
                     "Run element must contain a ws attribute. Run text: This is a test!"));
 }
Пример #3
0
        public void DeserializeTsStringFromXml_Decompose()
        {
            ITsString tss = TsStringSerializer.DeserializeTsStringFromXml(
                "<Str><Run ws=\"en\">Laa yra la m\u00E9n</Run></Str>", WritingSystemManager);

            Assert.IsNotNull(tss);
            TssAssert.StringEqual("Laa yra la me\u0301n", tss);
            TssAssert.WsEqual(EnWS, tss);
            TssAssert.NoStrProps(tss);
        }
Пример #4
0
        public void DeserializeTsStringFromXml_WithStyle()
        {
            ITsString tss = TsStringSerializer.DeserializeTsStringFromXml(
                "<Str><Run ws='en' namedStyle='Monkey'>This is a test!</Run></Str>", WritingSystemManager);

            Assert.IsNotNull(tss);
            TssAssert.StringEqual("This is a test!", tss);
            TssAssert.WsEqual(EnWS, tss);
            TssAssert.StyleEqual("Monkey", tss);
        }
Пример #5
0
        public void DeserializeTsStringFromXml_MultiStringWithNoRunElement()
        {
            ITsString tss = TsStringSerializer.DeserializeTsStringFromXml(
                "<AStr ws='en'>This is a test!</AStr>", WritingSystemManager);

            Assert.IsNotNull(tss);
            TssAssert.StringEqual("This is a test!", tss);
            TssAssert.WsEqual(EnWS, tss);
            TssAssert.NoStrProps(tss);
        }
Пример #6
0
        public void DeserializeTsStringFromXml_Simple()
        {
            ITsString tss = TsStringSerializer.DeserializeTsStringFromXml(
                "<Str><Run ws='en'>This is a test!</Run></Str>", WritingSystemManager);

            Assert.IsNotNull(tss);
            TssAssert.StringEqual("This is a test!", tss);
            TssAssert.WsEqual(EnWS, tss);
            TssAssert.NoStrProps(tss);
        }
Пример #7
0
        public void DeserializeTsStringFromXml_WithExternalLink()
        {
            ITsString tss = TsStringSerializer.DeserializeTsStringFromXml(
                @"<Str><Run ws='en' externalLink='C:\Idont\exist\here.doc'>document</Run></Str>",
                WritingSystemManager);

            Assert.IsNotNull(tss);
            TssAssert.StringEqual("document", tss);
            TssAssert.WsEqual(EnWS, tss);
            TssAssert.ObjDataEqual((char)FwObjDataTypes.kodtExternalPathName + @"C:\Idont\exist\here.doc", tss);
        }
Пример #8
0
        public void DeserializeTsStringFromXml_WithEmbeddedData()
        {
            ITsString tss = TsStringSerializer.DeserializeTsStringFromXml(
                "<Str><Run ws='en' embedded='&lt;FN&gt;&lt;M&gt;a&lt;/M&gt;&lt;/FN&gt;'>a</Run></Str>",
                WritingSystemManager);

            Assert.IsNotNull(tss);
            TssAssert.StringEqual("a", tss);
            TssAssert.WsEqual(EnWS, tss);
            TssAssert.ObjDataEqual((char)FwObjDataTypes.kodtEmbeddedObjectData + "<FN><M>a</M></FN>", tss);
        }
Пример #9
0
        public void DeserializeTsStringFromXml_MultiStringHandlesDifferentWS()
        {
            ITsString tss = TsStringSerializer.DeserializeTsStringFromXml(
                "<AStr ws='en'><Run ws='es'>This is a test!</Run></AStr>", WritingSystemManager);

            Assert.IsNotNull(tss);
            Assert.AreEqual(1, tss.RunCount);
            TssAssert.StringEqual("This is a test!", tss);
            TssAssert.WsEqual(EsWS, tss);
            TssAssert.NoStrProps(tss);
        }
Пример #10
0
        public void DeserializeTsStringFromXml_WithOwningLink()
        {
            Guid      expectedGuid = Guid.NewGuid();
            ITsString tss          = TsStringSerializer.DeserializeTsStringFromXml(
                "<Str><Run ws='en' ownlink='" + expectedGuid + "'></Run></Str>",
                WritingSystemManager);

            Assert.IsNotNull(tss);
            TssAssert.StringEqual(StringUtils.kChObject.ToString(), tss);
            TssAssert.WsEqual(EnWS, tss);
            TssAssert.FootnoteEqual(expectedGuid, FwObjDataTypes.kodtOwnNameGuidHot, tss);
        }
Пример #11
0
        public void DeserializeTsStringFromXml_MultipleRuns()
        {
            ITsString tss = TsStringSerializer.DeserializeTsStringFromXml(
                "<Str><Run ws='en'>This is a </Run><Run ws='es' namedStyle='Monkey'>Laa yra la m\u00E9n</Run></Str>",
                WritingSystemManager);

            Assert.IsNotNull(tss);
            Assert.AreEqual(2, tss.RunCount);
            // Check run one
            TssAssert.RunEqual("This is a ", tss, 0, 0);
            TssAssert.WsEqual(EnWS, tss, 0);
            TssAssert.NoStrProps(tss, 0);
            // Check run two
            TssAssert.RunEqual("Laa yra la me\u0301n", tss, 1, 10);
            TssAssert.WsEqual(EsWS, tss, 1);
            TssAssert.StyleEqual("Monkey", tss, 1);
        }
Пример #12
0
 public void DeserializeTsStringFromXml_MultiStringWithStyleAndNoWsInRun()
 {
     TsStringSerializer.DeserializeTsStringFromXml(
         "<AStr ws='en'><Run namedStyle='Monkey'>This is a test!</Run></AStr>",
         WritingSystemManager);
 }
Пример #13
0
 public void DeserializeTsStringFromXml_NoWsInRun()
 {
     TsStringSerializer.DeserializeTsStringFromXml(
         "<Str><Run>This is a test!</Run></Str>", WritingSystemManager);
 }