{"id":216,"date":"2010-02-04T08:00:26","date_gmt":"2010-02-04T13:00:26","guid":{"rendered":"http:\/\/hoolihan.net\/blog-tim\/?p=216"},"modified":"2010-02-04T08:07:02","modified_gmt":"2010-02-04T13:07:02","slug":"216","status":"publish","type":"post","link":"http:\/\/hoolihan.net\/blog-tim\/2010\/02\/04\/216\/","title":{"rendered":"MSpec &#8220;Hello World&#8221; Sample"},"content":{"rendered":"<p>I&#8217;ve been working with <a href=\"http:\/\/github.com\/machine\/machine.specifications\">MSpec<\/a> lately.  It&#8217;s a BDD framework for .Net.  Here&#8217;s a hello world type example that uses Trace Writing to show a little bit about what it does.<\/p>\n<pre>\r\n<code>using System;\r\nusing Machine.Specifications;\r\nusing System.Diagnostics;\r\n\r\nnamespace UnitedIndustrial.DataImportConcerns\r\n{\r\n    [Subject(\"Sample\")]\r\n    public class SampleConcerns\r\n    {\r\n        static string _myString;\r\n        Establish _context = () =&gt;\r\n        {\r\n            _myString = \"value from context\";\r\n            LocationValueDump(\"context\");\r\n        };\r\n\r\n        Because _of = () =&gt;\r\n         {\r\n             _myString = \"value from because\";\r\n             LocationValueDump(\"because\");\r\n         };\r\n\r\n        It _shouldKnow1And1Equals2 = () =&gt;\r\n         {\r\n             (1 + 1).ShouldEqual(2);\r\n             LocationValueDump(\"_shouldKnow1And1Equals2\");\r\n         };\r\n\r\n        It _shouldKnowANewStringIsNotNull = () =&gt;\r\n        {\r\n            \"hello\".ShouldNotBeNull();\r\n            LocationValueDump(\"_shouldKnowANewStringIsNotNull\");\r\n        };\r\n\r\n        private static void LocationValueDump(string location)\r\n        {\r\n            Trace.WriteLine(\r\n                String.Format(\"in {0} _myString is {1}\",\r\n                location, _myString));\r\n        }\r\n    }\r\n}<\/code>\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been working with MSpec lately. It&#8217;s a BDD framework for .Net. Here&#8217;s a hello world type example that uses Trace Writing to show a little bit about what it does. using System; using Machine.Specifications; using System.Diagnostics; namespace UnitedIndustrial.DataImportConcerns { [Subject(&#8220;Sample&#8221;)] public class SampleConcerns { static string _myString; Establish _context = () =&gt; { _myString [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34,18],"tags":[41,97,69,98],"class_list":["post-216","post","type-post","status-publish","format-standard","hentry","category-microsoft","category-programming","tag-net","tag-bdd","tag-linkedin","tag-mspec"],"_links":{"self":[{"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/posts\/216","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/comments?post=216"}],"version-history":[{"count":0,"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/posts\/216\/revisions"}],"wp:attachment":[{"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/media?parent=216"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/categories?post=216"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/tags?post=216"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}