{"id":2221,"date":"2011-05-25T00:34:13","date_gmt":"2011-05-24T06:34:13","guid":{"rendered":"http:\/\/www.moonmile.net\/blog\/archives\/2221"},"modified":"2011-05-25T00:35:48","modified_gmt":"2011-05-24T15:35:48","slug":"%e4%b8%8a%e6%b5%b7%e3%81%a7%e5%ae%9f%e6%bc%94%e3%81%97%e3%81%9f%e3%83%86%e3%82%b9%e3%83%88%e3%82%b1%e3%83%bc%e3%82%b9%e3%81%ae%e6%96%b9%e9%87%9d%ef%bc%88%e3%83%a1%e3%83%a2%ef%bc%89%e3%81%9d%e3%81%ae","status":"publish","type":"post","link":"http:\/\/www.moonmile.net\/blog\/archives\/2221","title":{"rendered":"\u4e0a\u6d77\u3067\u5b9f\u6f14\u3057\u305f\u30c6\u30b9\u30c8\u30b1\u30fc\u30b9\u306e\u65b9\u91dd\uff08\u30e1\u30e2\uff09\u305d\u306e\uff12"},"content":{"rendered":"<p>\u4e0a\u6d77\u3067\u5b9f\u6f14\u3057\u305f\u30c6\u30b9\u30c8\u30b1\u30fc\u30b9\u306e\u65b9\u91dd\uff08\u30e1\u30e2\uff09 | Moonmile Solutions Blog<br \/>\n<a href=\"http:\/\/www.moonmile.net\/blog\/archives\/2217\">http:\/\/www.moonmile.net\/blog\/archives\/2217<\/a><\/p>\n<p>\u306e\u7b2c\uff12\u5f3e&#8230;\u306e\u30e1\u30e2\u3067\u3059\u3002<br \/>\n\u5148\u306e\u4f8b\u3067\u306f\u3001DAO(Data Access Object)\u306a\u306e\u3067\u30c6\u30b9\u30c8\u5bfe\u8c61\u306f\u4e3b\u306b SQL \u306b\u306a\u308b\u8a33\u3067\u3059\u304c\u3001\u4eca\u5ea6\u306f\u696d\u52d9\u30ed\u30b8\u30c3\u30af(business logic)\u3092\u4e2d\u5fc3\u306b\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n<p>\u696d\u52d9\u30ed\u30b8\u30c3\u30af\u306e\u5834\u5408\u306f\u3001\u57fa\u672c\u306f\u4ee5\u4e0b\u306e 4 \u7b87\u6240\u304c\u30c6\u30b9\u30c8\u306e\u5bfe\u8c61\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u30e1\u30bd\u30c3\u30c9\u306e\u30d1\u30e9\u30e1\u30fc\u30bf<\/li>\n<li>if \u6587\u306b\u3088\u308b\u5206\u5c90<\/li>\n<li>for \u6587\u306b\u3088\u308b\u7e70\u308a\u8fd4\u3057<\/li>\n<li>\u5185\u90e8\u30e1\u30bd\u30c3\u30c9\u306e\u547c\u3073\u51fa\u3057<\/li>\n<\/ul>\n<p>\u3053\u3053\u3067\u3001\u5185\u90e8\u30e1\u30bd\u30c3\u30c9\u306e\u547c\u3073\u51fa\u3057\u306f<strong>\u65e2\u306b\u30c6\u30b9\u30c8\u6e08\u307f<\/strong>\u3067\u3042\u308b\u3053\u3068\u304c\u524d\u63d0\u3067\u3059\u3002<\/p>\n<p>\u30b5\u30f3\u30d7\u30eb\u7684\u306b\u306f\u6b21\u306e\u30b3\u30fc\u30c9\u3092\u982d\u306b\u5165\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n\/\/ \u5f15\u6570\u306f, id \u3068 name \u306e 2 \u3064\r\npublic int func( int id, string name )\r\n{\r\n\t\/\/ \u30d1\u30e9\u30e1\u30fc\u30bf\u3067\u5224\u5225\r\n\tif ( id == 0 ) {\r\n\t\treturn -1;\r\n\t}\r\n\t\/\/ \u5185\u90e8\u95a2\u6570\u306e\u547c\u3073\u51fa\u3057\r\n\tDataTable dt = this.GetPersons( name );\r\n\t\/\/ \u7e70\u308a\u8fd4\u3057\u51e6\u7406\r\n\tforeach ( DataRow row in dt.Rows )\r\n\t{\r\n\t\tif ( id == (int)row&#x5B;&quot;id&quot;] ) {\r\n\t\t\t\/\/ \u6b63\u5e38\u5024\r\n\t\t\treturn (int)row&#x5B;&quot;age&quot;];\r\n\t\t}\r\n\t}\r\n\t\/\/ \u7570\u5e38\u5024\r\n\treturn -1;\r\n}\r\n\r\n<\/pre>\n<p>\u25a0\u30c6\u30b9\u30c8\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u9806\u756a<\/p>\n<p>\u524d\u56de\u306e DAO \u3068\u540c\u3058\u3088\u3046\u306b\u3001\u7c21\u5358\u306a\u3082\u306e\u304b\u3089\u8907\u96d1\u306a\u3082\u306e\u3078\u3068\u9032\u3081\u3066\u3044\u304d\u307e\u3059\u3002\u524d\u306e\u30c6\u30b9\u30c8\u30b3\u30fc\u30c9\u304c\u30b3\u30d4\u30fc\uff06\u30da\u30fc\u30b9\u30c8\u3067\u4f7f\u3048\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>0) TestZero<\/p>\n<p>\u52d5\u4f5c\u78ba\u8a8d\u306e\u30c6\u30b9\u30c8\u30b3\u30fc\u30c9\u3092\u66f8\u304d\u307e\u3059\u3002<\/p>\n<p>1) TestOK<\/p>\n<p>\u6b63\u5e38\u7cfb\u304c\u901a\u308b\u30c6\u30b9\u30c8\u30b3\u30fc\u30c9\u3092\u66f8\u304d\u307e\u3059\u3002<\/p>\n<p>2) TestNG<\/p>\n<p>\u623b\u308a\u5024\u304c\u7570\u5e38\u5024\u3068\u306a\u308b\u30c6\u30b9\u30c8\u30b3\u30fc\u30c9\u3092\u66f8\u304d\u307e\u3059\u3002<\/p>\n<p>3) TestParam<\/p>\n<p>\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u5909\u5316\u3057\u305f\u6642\u306e\u623b\u308a\u5024\u3092\u30c1\u30a7\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n<p>4) TestIf<\/p>\n<p>\u6761\u4ef6\u5206\u5c90\u306b\u5bfe\u3059\u308b\u30c6\u30b9\u30c8\u3067\u3059\u3002<br \/>\nswitch-case \u306b\u3088\u308b\u8907\u6570\u5206\u5c90\u3082\u3053\u3053\u306b\u5165\u308c\u307e\u3059\uff08\u8907\u6570\u5206\u5c90\u306e\u5834\u5408\u306f\u3001\u7db2\u7f85\u6027\u3092\u8ffd\u6c42\u305b\u305a\u3001\u30b5\u30f3\u30d7\u30ea\u30f3\u30b0\u3057\u307e\u3059\uff09<\/p>\n<p>5) TestFor<\/p>\n<p>\u7e70\u308a\u8fd4\u3057\u304c1\u56de\u306e\u5834\u5408\u3001\u8907\u6570\u56de\u306e\u5834\u5408\u30010\u56de\u306e\u5834\u5408\u3092\u30c1\u30a7\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n<p>6) TestBorder<\/p>\n<p>\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5909\u66f4\u306b\u3088\u308b\u5883\u754c\u5024\u8a66\u9a13\u3067\u3059\u3002<\/p>\n<p>7) TestInner<\/p>\n<p>\u5185\u90e8\u30e1\u30bd\u30c3\u30c9\u306b\u6e21\u3059\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u5909\u5316\u3059\u308b\u30d1\u30bf\u30fc\u30f3\u3092\u30c1\u30a7\u30c3\u30af\u3057\u307e\u3059\u3002<br \/>\n\u5185\u90e8\u30e1\u30bd\u30c3\u30c9\u306b\u3064\u3044\u3066\u30c6\u30b9\u30c8\u6e08\u307f\u306a\u306e\u3067\u3001\u30d1\u30e9\u30e1\u30fc\u30bf\u3088\u308a\u5f15\u304d\u6e21\u3055\u308c\u308b\u6761\u4ef6\u3067\u30012,3 \u3050\u3089\u3044\u30c1\u30a7\u30c3\u30af\u3059\u308c\u3070\u5341\u5206\u3067\u3059\u3002<\/p>\n<p>\u307e\u3041\u3001\u3056\u3063\u3068\u3053\u3093\u306a\u611f\u3058\u3067\u30d1\u30bf\u30fc\u30f3\u3092\u982d\u306b\u5165\u308c\u3066\u304a\u3051\u3070\u3001OK \u3068\u3044\u3046\u3053\u3068\u3067\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e0a\u6d77\u3067\u5b9f\u6f14\u3057\u305f\u30c6\u30b9\u30c8\u30b1\u30fc\u30b9\u306e\u65b9\u91dd\uff08\u30e1\u30e2\uff09 | Moonmile Solutions Blog http:\/\/www.moonmile.net\/blog\/archives\/2217 \u306e\u7b2c\uff12\u5f3e&#8230;\u306e\u30e1\u30e2\u3067\u3059\u3002 \u5148\u306e &hellip; <a href=\"http:\/\/www.moonmile.net\/blog\/archives\/2221\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3,24],"tags":[],"class_list":["post-2221","post","type-post","status-publish","format-standard","hentry","category-dev","category-xunit"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/2221","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/comments?post=2221"}],"version-history":[{"count":1,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/2221\/revisions"}],"predecessor-version":[{"id":2222,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/2221\/revisions\/2222"}],"wp:attachment":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/media?parent=2221"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/categories?post=2221"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/tags?post=2221"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}