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

            var index = sut.Backspace(12);

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

            index = sut.Backspace(24);
            Assert.AreEqual(23, index);
            Assert.AreEqual("ab cd efg hjklmn op qrs", sut.Line);
            Assert.AreEqual(new[] { "ab cd ", "efg ", "hjklm", "n op ", "qrs" }, sut.SoftLines);
        }