OSDN Git Service

Document.ReplaceAll2のテストを書いていなかった
authorkonekoneko <test2214@hotmail.co.jp>
Thu, 9 Jul 2015 15:16:31 +0000 (00:16 +0900)
committerkonekoneko <test2214@hotmail.co.jp>
Thu, 9 Jul 2015 15:16:31 +0000 (00:16 +0900)
WPF/UnitTest/UnitTest2.cs

index 5b7937f..fbf3d42 100644 (file)
@@ -344,13 +344,12 @@ namespace UnitTest
         [TestMethod]
         public void ReplaceAllTest()
         {
-            StringBuffer buf = new StringBuffer();
-            string str = "this is a pen";
-            buf.Replace(0, 0, str, str.Length);
-            buf.Replace("is", "aaa");
-            string excpect = str.Replace("is", "aaa");
-            for (int i = 0; i < excpect.Length; i++)
-                Assert.IsTrue(buf[i] == excpect[i]);
+            DummyRender render = new DummyRender();
+            Document doc = new Document();
+            doc.LayoutLines.Render = render;
+            doc.Append("this is a pen");
+            doc.ReplaceAll2("is", "aaa");
+            Assert.IsTrue(doc.ToString(0) == "thaaa aaa a pen");
         }
 
         [TestMethod]