Esempio 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());
        }
Esempio n. 2
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());
        }
Esempio n. 3
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());
        }
Esempio n. 4
0
        public void ItRemovesTextAtTheEnd()
        {
            var tbl = new PieceTable("Hello worldasdasd");

            tbl.Remove(11, 6);

            Assert.AreEqual("Hello world", tbl.ToString());
        }
Esempio n. 5
0
        public void ItRemovesTextAtTheBeginning()
        {
            var tbl = new PieceTable("asdasd Hello world");

            tbl.Remove(0, 7);

            Assert.AreEqual("Hello world", tbl.ToString());
        }
Esempio n. 6
0
        public void ItRemovesText()
        {
            var tbl = new PieceTable("Hello asdasd world");

            tbl.Remove(6, 7);

            Assert.AreEqual("Hello world", tbl.ToString());
        }
Esempio n. 7
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());
        }
Esempio n. 8
0
        public void ItReturnsTheString()
        {
            var tbl = new PieceTable("original");

            Assert.AreEqual("original", tbl.ToString());
        }