OSDN Git Service

Directoryの取得に仮対応
authorkimikage <kimikage_ceo@hotmail.com>
Tue, 25 Oct 2011 00:18:03 +0000 (09:18 +0900)
committerkimikage <kimikage_ceo@hotmail.com>
Tue, 25 Oct 2011 00:18:03 +0000 (09:18 +0900)
Karinto/FilePath.cs
KarintoTest/FilePathTest.cs

index 01f2c48..7f2c707 100755 (executable)
@@ -118,8 +118,18 @@ namespace Karinto
 \r
         public string Directory\r
         {\r
-            get;\r
-            set;\r
+            get\r
+            {\r
+                if (directory != null)\r
+                {\r
+                    return directory;\r
+                }\r
+                return "";\r
+            }\r
+            set\r
+            {\r
+                throw new NotImplementedException();\r
+            }\r
         }\r
 \r
         public FilePath Parent\r
index 7b14ce1..dfba26b 100755 (executable)
@@ -9,6 +9,8 @@ using System;
 using System.Collections.Generic;\r
 using System.Text;\r
 using System.Diagnostics;\r
+using System.Reflection;\r
+using System.Text.RegularExpressions;\r
 using Karinto;\r
 using NUnit.Framework;\r
 \r
@@ -25,5 +27,16 @@ namespace KarintoTest
             Assert.AreEqual(".test", path.Extension);\r
             FilePath.WorkDirectory = System.IO.Path.GetTempPath();\r
         }\r
+\r
+        [Test]\r
+        public void AbsolutePath()\r
+        {\r
+            string exePath = Assembly.GetExecutingAssembly().Location;\r
+            FilePath path = new FilePath(exePath);\r
+            Assert.AreEqual("KarintoTest", path.BaseName);\r
+            Assert.AreEqual(".dll", path.Extension);\r
+            Assert.IsNotNull(path.Directory);\r
+            Assert.IsTrue(Regex.Match(path.Directory,@"[/\\]KarintoTest[/\\]bin[/\]").Success);\r
+        }\r
     }\r
 }\r