{"id":1061,"date":"2011-06-27T12:05:25","date_gmt":"2011-06-27T03:05:25","guid":{"rendered":"http:\/\/www.lancard.com\/blog\/?p=1061"},"modified":"2025-03-12T11:31:17","modified_gmt":"2025-03-12T02:31:17","slug":"vb-net-nunit-2-5-%e3%81%ae-assert-throws-%e3%81%a7%e4%be%8b%e5%a4%96%e3%81%ae%e3%83%86%e3%82%b9%e3%83%88","status":"publish","type":"post","link":"https:\/\/www.lancard.com\/blog\/2011\/06\/27\/vb-net-nunit-2-5-%e3%81%ae-assert-throws-%e3%81%a7%e4%be%8b%e5%a4%96%e3%81%ae%e3%83%86%e3%82%b9%e3%83%88\/","title":{"rendered":"VB.NET + NUnit 2.5 \u306e Assert.Throws \u3067\u4f8b\u5916\u306e\u30c6\u30b9\u30c8"},"content":{"rendered":"<p><a href=\"http:\/\/www.tdd-net.jp\/2010\/04\/nunit-25-assert.html\">[\u30d6\u30ed\u30b0\u7d39\u4ecb] NUnit 2.5 \u3067\u8ffd\u52a0\u3055\u308c\u305f Assert.Throws: TDD.NET<\/a><\/p>\n<p>\u3092\u53c2\u8003\u306b VB.NET \u306e\u66f8\u304d\u65b9\u306b\u3057\u305f\u3060\u3051\u3067\u3059\u304c\u3002<\/p>\n<pre lang=\"vbnet\" line=\"1\">\r\nImports NUnit.Framework\r\n<TestFixture()>\r\nPublic Class ExceptionTest\r\n    Private Shared Function throwArgumentException(ByVal obj As Object) As String\r\n        Throw New ArgumentException(\"VarType Error: \" & TypeName(obj))\r\n    End Function\r\n\r\n    <TestCase(True, \"VarType Error: Boolean\")>\r\n    Public Sub ArgumentExceptionTest(ByVal obj As Object, ByVal expected As String)\r\n        Dim ex = Assert.Throws(Of ArgumentException)(\r\n            Function() throwArgumentException(obj)\r\n        )\r\n        Assert.That(ex.Message = expected)\r\n    End Sub\r\nEnd Class\r\n<\/pre>\n<p>\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u306f\u5b9f\u969b\u306e\u30b3\u30fc\u30c9\u3092\u7de8\u96c6\u3057\u3066\u66f8\u304d\u307e\u3057\u305f\u304c\u52d5\u4f5c\u78ba\u8a8d\u3057\u3066\u306a\u3044\u306e\u3067\u53c2\u8003\u7a0b\u5ea6\u306b\u3002<\/p>\n<p>.NET \u306e\u30b5\u30f3\u30d7\u30eb\u3063\u3066C#\u306e\u5834\u5408\u304c\u591a\u3044\u306e\u3067\u300cVB.NET\u3067\u306f\u3069\u3046\u66f8\u3051\u3070\u3044\u3044\u306e\u304b\u306a\u3041\u300d\u3063\u3066\u3053\u3068\u3082\u7d50\u69cb\u3042\u308a\u307e\u3059\u3002<\/p>\n<a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-facebook nolightbox\" data-provider=\"facebook\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Facebook\" href=\"https:\/\/www.facebook.com\/sharer.php?u=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F1061&#038;t=VB.NET%20%2B%20NUnit%202.5%20%E3%81%AE%20Assert.Throws%20%E3%81%A7%E4%BE%8B%E5%A4%96%E3%81%AE%E3%83%86%E3%82%B9%E3%83%88&#038;s=100&#038;p&#091;url&#093;=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F1061&#038;p&#091;images&#093;&#091;0&#093;=&#038;p&#091;title&#093;=VB.NET%20%2B%20NUnit%202.5%20%E3%81%AE%20Assert.Throws%20%E3%81%A7%E4%BE%8B%E5%A4%96%E3%81%AE%E3%83%86%E3%82%B9%E3%83%88\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"Facebook\" title=\"Share on Facebook\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/facebook.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-twitter nolightbox\" data-provider=\"twitter\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Twitter\" href=\"http:\/\/twitter.com\/share?url=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F1061&#038;text=VB.NET%20%2B%20NUnit%202.5%20%E3%81%AE%20Assert.Throws%20%E3%81%A7%E4%BE%8B%E5%A4%96%E3%81%AE%E3%83%86%E3%82%B9%E3%83%88\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"twitter\" title=\"Share on Twitter\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/twitter.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-linkedin nolightbox\" data-provider=\"linkedin\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Linkedin\" href=\"https:\/\/www.linkedin.com\/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F1061&#038;title=VB.NET%20%2B%20NUnit%202.5%20%E3%81%AE%20Assert.Throws%20%E3%81%A7%E4%BE%8B%E5%A4%96%E3%81%AE%E3%83%86%E3%82%B9%E3%83%88\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"linkedin\" title=\"Share on Linkedin\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/linkedin.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-tumblr nolightbox\" data-provider=\"tumblr\" target=\"_blank\" rel=\"nofollow\" title=\"Share on tumblr\" href=\"https:\/\/tumblr.com\/share?s=&#038;v=3&#038;t=VB.NET%20%2B%20NUnit%202.5%20%E3%81%AE%20Assert.Throws%20%E3%81%A7%E4%BE%8B%E5%A4%96%E3%81%AE%E3%83%86%E3%82%B9%E3%83%88&#038;u=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F1061\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"tumblr\" title=\"Share on tumblr\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/tumblr.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-mail nolightbox\" data-provider=\"mail\" rel=\"nofollow\" title=\"Share by email\" href=\"mailto:?subject=VB.NET%20%2B%20NUnit%202.5%20%E3%81%AE%20Assert.Throws%20%E3%81%A7%E4%BE%8B%E5%A4%96%E3%81%AE%E3%83%86%E3%82%B9%E3%83%88&#038;body=%E3%82%B7%E3%82%A7%E3%82%A2%E3%81%99%E3%82%8B%EF%BC%9A:%20https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F1061\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"mail\" title=\"Share by email\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/mail.png\" \/><\/a>","protected":false},"excerpt":{"rendered":"<p>[\u30d6\u30ed\u30b0\u7d39\u4ecb] NUnit 2.5 \u3067\u8ffd\u52a0\u3055\u308c\u305f Assert.Throws: TDD.NET \u3092\u53c2\u8003\u306b VB.NET \u306e\u66f8\u304d\u65b9\u306b\u3057\u305f\u3060\u3051\u3067\u3059\u304c\u3002 Imports NUnit.Framework Public Class [&hellip;]<\/p>\n","protected":false},"author":12,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[52],"tags":[54],"class_list":["post-1061","post","type-post","status-publish","format-standard","hentry","category-net","tag-vb"],"_links":{"self":[{"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/posts\/1061","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/comments?post=1061"}],"version-history":[{"count":9,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/posts\/1061\/revisions"}],"predecessor-version":[{"id":8276,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/posts\/1061\/revisions\/8276"}],"wp:attachment":[{"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/media?parent=1061"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/categories?post=1061"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/tags?post=1061"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}