Ejemplo n.º 1
0
        public void ToDelta_SectionHeader()
        {
            XElement usxElem = Usx("PHM",
                                   Chapter("1"),
                                   Para("p",
                                        Verse("1"),
                                        Verse("2")),
                                   Para("s"),
                                   Para("p",
                                        Verse("3")));

            DeltaUsxMapper mapper   = CreateMapper();
            Delta          newDelta = mapper.ToDelta("12345", usxElem);

            var expected = Delta.New()
                           .InsertChapter("1")
                           .InsertVerse("1")
                           .InsertBlank("verse_1_1")
                           .InsertVerse("2")
                           .InsertBlank("verse_1_2")
                           .InsertPara("p")
                           .InsertBlank("s_1")
                           .InsertPara("s")
                           .InsertVerse("3")
                           .InsertBlank("verse_1_3")
                           .InsertPara("p")
                           .Insert("\n");

            Assert.IsTrue(newDelta.DeepEquals(expected));
        }
Ejemplo n.º 2
0
        public void ToDelta_Note()
        {
            XElement usxElem = Usx("PHM",
                                   Chapter("1"),
                                   Para("p",
                                        Verse("1"),
                                        "This is a verse with a footnote",
                                        Note("f", "+",
                                             Char("fr", "1.1: "),
                                             Char("ft", "Refers to "),
                                             Char("fq", "a footnote"),
                                             ". ",
                                             Char("xt", "John 1:1"),
                                             " and ",
                                             Char("xt", "Mark 1:1"),
                                             "."),
                                        ", so that we can test it."));

            DeltaUsxMapper mapper   = CreateMapper();
            Delta          newDelta = mapper.ToDelta("12345", usxElem);

            var expected = Delta.New()
                           .InsertChapter("1")
                           .InsertVerse("1")
                           .InsertText("This is a verse with a footnote", "verse_1_1")
                           .InsertNote(0, Delta.New()
                                       .InsertChar("1.1: ", "fr")
                                       .InsertChar("Refers to ", "ft")
                                       .InsertChar("a footnote", "fq")
                                       .Insert(". ")
                                       .InsertChar("John 1:1", "xt")
                                       .Insert(" and ")
                                       .InsertChar("Mark 1:1", "xt")
                                       .Insert("."), "f", "+", "verse_1_1")
                           .InsertText(", so that we can test it.", "verse_1_1")
                           .InsertPara("p")
                           .Insert("\n");

            Assert.IsTrue(newDelta.DeepEquals(expected));
        }