コード例 #1
0
        public void Deletions()
        {
            //0123456789012345678901234
            var sut = new LineEditor("ab cd efg hijklmn op qrst", 5);

            var index = sut.Delete(12);

            Assert.AreEqual(12, index);
            //012345678901234567890123
            Assert.AreEqual("ab cd efg hiklmn op qrst", sut.Line);
            Assert.AreEqual(new[] { "ab cd ", "efg ", "hiklm", "n op ", "qrst" }, sut.SoftLines);

            index = sut.Delete(23);
            Assert.AreEqual(22, index);
            //012345678901234567890123
            Assert.AreEqual("ab cd efg hiklmn op qrs", sut.Line);
            Assert.AreEqual(new[] { "ab cd ", "efg ", "hiklm", "n op ", "qrs" }, sut.SoftLines);

            index = sut.Delete(5);
            Assert.AreEqual(5, index);
            Assert.AreEqual("ab cdefg hiklmn op qrs", sut.Line);
            Assert.AreEqual(new[] { "ab ", "cdefg ", "hiklm", "n op ", "qrs" }, sut.SoftLines);
        }