OSDN Git Service

document.getlines()で無駄な計算を行っているので無駄をなくした
[fooeditengine/FooEditEngine.git] / WPF / UnitTest / UnitTest2.cs
index 103cc94..bafb36b 100644 (file)
@@ -9,6 +9,7 @@
 You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 using System;
+using System.Linq;
 using System.Text.RegularExpressions;
 using System.Collections.Generic;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
@@ -108,5 +109,16 @@ namespace UnitTest
             Assert.IsTrue(count == 2);
             Assert.IsTrue(reader.Peek() == -1);
         }
+
+        [TestMethod]
+        public void GetLinesText()
+        {
+            Document doc = new Document();
+            doc.Append("a\nb\nc");
+            var result = doc.GetLines(0, doc.Length - 1).ToArray();
+            Assert.AreEqual("a\n", result[0]);
+            Assert.AreEqual("b\n", result[1]);
+            Assert.AreEqual("c", result[2]);
+        }
     }
 }