Ejemplo n.º 1
0
        public void ItInsertsMultipleTexts()
        {
            var tbl = new PieceTable();

            tbl.Insert("Hello world", 0);
            tbl.Insert(" wonderful", 5);
            tbl.Insert(", this is a test!", tbl.ToString().Length);

            Assert.AreEqual("Hello wonderful world, this is a test!", tbl.ToString());
        }
Ejemplo n.º 2
0
        public void ItInsertsAndRemovesMultipleTexts()
        {
            var tbl = new PieceTable();

            tbl.Insert("Hello world", 0);
            tbl.Insert(" asdasd wonderful", 5);
            tbl.Insert(", this is a ajslkdhk test!", tbl.ToString().Length);
            tbl.Remove(5, 7);
            tbl.Remove(33, "ajslkdhk ".Length);

            Assert.AreEqual("Hello wonderful world, this is a test!", tbl.ToString());
        }
Ejemplo n.º 3
0
        public void ItInsertsTextInTheMiddle()
        {
            var tbl = new PieceTable("Lorem dolor sit amet");

            tbl.Insert(" ipsum", 5);

            Assert.AreEqual("Lorem ipsum dolor sit amet", tbl.ToString());
        }
Ejemplo n.º 4
0
        public void ItInsertsTextAtTheEnd()
        {
            var tbl = new PieceTable("Hello");

            tbl.Insert(" world", tbl.ToString().Length);

            Assert.AreEqual("Hello", tbl.Original);
            Assert.AreEqual(" world", tbl.Add);
            Assert.AreEqual(2, tbl.Pieces.Count);

            Assert.AreEqual("Hello world", tbl.ToString());
        }