<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-1759021816486600143</atom:id><lastBuildDate>Sat, 28 Sep 2024 22:10:33 +0000</lastBuildDate><category>.NET</category><category>Development</category><category>Best Practices</category><category>C#</category><category>TDD</category><category>Design Patterns</category><category>Tools</category><category>ASP.NET</category><category>MVC</category><category>Mocking</category><category>System Architecture</category><category>Data Access</category><category>Continues Integration</category><category>Teamwork</category><category>javascript</category><category>Blogging</category><category>Boise Code Camp</category><category>Fundamentals</category><category>Jquery</category><category>Mono</category><category>Pair Programing</category><category>Refactoring</category><category>Visual Studio 2010</category><category>Amazon Web Services</category><category>Cloud Computing</category><category>Code-Camp</category><category>Documentation</category><category>Enterprise</category><category>Heros</category><category>ICSharpZip</category><category>IOC</category><category>New Look</category><category>Podcast</category><category>Sample Code Repository</category><category>Security</category><category>Telerik</category><category>WCF</category><category>WMI</category><category>Zip Files</category><category>extension methods</category><category>moq</category><category>project completion dates</category><title>The janitor&#39;s closet</title><description>The random rantings of a PERL Unix/Linux geek turned .NET Developer, and it all started with mono</description><link>http://bob-the-janitor.blogspot.com/</link><managingEditor>noreply@blogger.com (Bob The Janitor)</managingEditor><generator>Blogger</generator><openSearch:totalResults>68</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-8977220237916653625</guid><pubDate>Mon, 26 Mar 2018 15:10:00 +0000</pubDate><atom:updated>2018-03-26T09:22:00.260-06:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">Boise Code Camp</category><category domain="http://www.blogger.com/atom/ns#">Continues Integration</category><category domain="http://www.blogger.com/atom/ns#">TDD</category><title>Boise Code Camp Presentation on Into to Continues Integration </title><description>&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;verdana&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 13px;&quot;&gt;This year at Boise Code Camp I presented on Into to Continues Integration and here are the&amp;nbsp;&lt;a href=&quot;https://www.dropbox.com/s/7jzo07ybvjlyeex/Intro%20to%20CI.pdf?dl=0&quot; target=&quot;_blank&quot;&gt;Slides&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: &amp;quot;verdana&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif; font-size: 13px;&quot;&gt;and the source Code&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://github.com/bobtjanitor/SampleTDDApp&quot; style=&quot;background-color: white; color: #336699; font-family: Verdana, Arial, sans-serif; font-size: 13px;&quot; target=&quot;_blank&quot;&gt;https://github.com/bobtjanitor/SampleTDDApp&lt;/a&gt;</description><link>http://bob-the-janitor.blogspot.com/2018/03/boise-code-camp-presentation-on-into-to.html</link><author>noreply@blogger.com (Bob The Janitor)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-2714378101013582092</guid><pubDate>Mon, 26 Mar 2018 15:00:00 +0000</pubDate><atom:updated>2018-03-26T09:22:16.582-06:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">Boise Code Camp</category><category domain="http://www.blogger.com/atom/ns#">TDD</category><title>Slides from my Into to TDD talk at Boise Code camp </title><description>This year at Boise Code Camp I presented on Into to TDD and here are the &lt;a href=&quot;https://www.dropbox.com/s/lvsfq57rsamlhlp/Intro%20To%20TDD.pdf?dl=0&quot; target=&quot;_blank&quot;&gt;slides&amp;nbsp;&lt;/a&gt;and the source Code&amp;nbsp;&lt;a href=&quot;https://github.com/bobtjanitor/SampleTDDApp&quot; target=&quot;_blank&quot;&gt;https://github.com/bobtjanitor/SampleTDDApp&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;</description><enclosure type='application/pdf' url='https://www.dropbox.com/s/lvsfq57rsamlhlp/Intro%20To%20TDD.pdf?dl=0' length='0'/><link>http://bob-the-janitor.blogspot.com/2018/03/slides-from-my-into-to-tdd-talk-at.html</link><author>noreply@blogger.com (Bob The Janitor)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-5849971968088084884</guid><pubDate>Tue, 23 Feb 2016 20:40:00 +0000</pubDate><atom:updated>2016-02-23T13:40:05.646-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><category domain="http://www.blogger.com/atom/ns#">MVC</category><category domain="http://www.blogger.com/atom/ns#">TDD</category><title>Unit Testing Asp.net MVC View Model Validation</title><description>&lt;p&gt;ViewModel attribute validation is a key feature of ASP.NET MVC, but is often not a tested one.&amp;#160; For the most part developers verify controller actions, pass in a model, mock the ModelState.IsValid property and call it good, never checking to make sure if the model is validating correctly.&amp;#160; One of the biggest reasons is developers just don’t know how, it’s not difficult, but it’s not very intuitive so here is a quick tutorial. &lt;/p&gt;  &lt;p&gt;First we take a view model with some basic validation attributes&lt;/p&gt; &lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;style type=&quot;text/css&quot;&gt;




.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, &quot;Courier New&quot;, courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #a31515; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}

.csharpcode .lnum { color: #606060; }&lt;/style&gt;  &lt;div class=&quot;csharpcode&quot;&gt;   &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   1:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;class&lt;/span&gt; RegisterViewModel&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   3:  &lt;/span&gt;    [Required]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   4:  &lt;/span&gt;    [EmailAddress]&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   5:  &lt;/span&gt;    [Display(Name = &lt;span class=&quot;str&quot;&gt;&amp;quot;Email&amp;quot;&lt;/span&gt;)]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   6:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; Email { &lt;span class=&quot;kwrd&quot;&gt;get&lt;/span&gt;; &lt;span class=&quot;kwrd&quot;&gt;set&lt;/span&gt;; }&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   7:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   8:  &lt;/span&gt;    [Required]&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   9:  &lt;/span&gt;    [StringLength(100, ErrorMessage = &lt;span class=&quot;str&quot;&gt;&amp;quot;The {0} must be at least {2} characters long.&amp;quot;&lt;/span&gt;, MinimumLength = 6)]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  10:  &lt;/span&gt;    [DataType(DataType.Password)]&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  11:  &lt;/span&gt;    [Display(Name = &lt;span class=&quot;str&quot;&gt;&amp;quot;Password&amp;quot;&lt;/span&gt;)]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  12:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; Password { &lt;span class=&quot;kwrd&quot;&gt;get&lt;/span&gt;; &lt;span class=&quot;kwrd&quot;&gt;set&lt;/span&gt;; }&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  13:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  14:  &lt;/span&gt;    [DataType(DataType.Password)]&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  15:  &lt;/span&gt;    [Display(Name = &lt;span class=&quot;str&quot;&gt;&amp;quot;Confirm password&amp;quot;&lt;/span&gt;)]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  16:  &lt;/span&gt;    [Compare(&lt;span class=&quot;str&quot;&gt;&amp;quot;Password&amp;quot;&lt;/span&gt;, ErrorMessage = &lt;span class=&quot;str&quot;&gt;&amp;quot;The password and confirmation password do not match.&amp;quot;&lt;/span&gt;)]&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  17:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; ConfirmPassword { &lt;span class=&quot;kwrd&quot;&gt;get&lt;/span&gt;; &lt;span class=&quot;kwrd&quot;&gt;set&lt;/span&gt;; }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  18:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Next we create a simple reusable testing context class &lt;/p&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;style type=&quot;text/css&quot;&gt;




.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, &quot;Courier New&quot;, courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #a31515; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}

.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;div class=&quot;csharpcode&quot;&gt;
  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   1:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;abstract&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;class&lt;/span&gt; ViewModelValidation_Context&amp;lt;T&amp;gt; where T : &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt;()&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   3:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; T Target;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   4:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; List&amp;lt;ValidationResult&amp;gt; ActualMessages;&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   5:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;bool&lt;/span&gt; Actual;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   6:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   7:  &lt;/span&gt;    [SetUp]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   8:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; SetUp()&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   9:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  10:  &lt;/span&gt;        Context();&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  11:  &lt;/span&gt;        Because();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  12:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  13:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  14:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;virtual&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; Context()&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  15:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  16:  &lt;/span&gt;        Target = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; T();&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  17:  &lt;/span&gt;        ActualMessages = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; List&amp;lt;ValidationResult&amp;gt;();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  18:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  19:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  20:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;virtual&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; Because()&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  21:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  22:  &lt;/span&gt;        &lt;span class=&quot;kwrd&quot;&gt;var&lt;/span&gt; context = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; ValidationContext(Target, &lt;span class=&quot;kwrd&quot;&gt;null&lt;/span&gt;, &lt;span class=&quot;kwrd&quot;&gt;null&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  23:  &lt;/span&gt;        Actual = Validator.TryValidateObject(Target, context, ActualMessages, &lt;span class=&quot;kwrd&quot;&gt;true&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  24:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  25:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Notice this test context class is a little different than what I have used in the past, we are predefining the Because() method.&amp;#160; In this case regardless of the class we are testing we are still going to run what is really the meat of this class, we create a Validation Context and then passes it to &lt;em&gt;System.ComponentModel.DataAnnotations.Validator.TryValidateObject&lt;/em&gt; and this returns if the view model passed validation and and validation messages.&lt;/p&gt;

&lt;p&gt;Next lets put this into action with a test to validate our model &lt;/p&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;style type=&quot;text/css&quot;&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, &quot;Courier New&quot;, courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #a31515; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}

.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;div class=&quot;csharpcode&quot;&gt;
  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   1:  &lt;/span&gt;[TestFixture]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   2:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;class&lt;/span&gt; When_Testing_RegisterViewModel_Validation_Test : ViewModelValidation_Context&amp;lt;RegisterViewModel&amp;gt;&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   3:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   4:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; Context()&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   5:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   6:  &lt;/span&gt;        &lt;span class=&quot;kwrd&quot;&gt;base&lt;/span&gt;.Context();&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   7:  &lt;/span&gt;        Target.Email = &lt;span class=&quot;str&quot;&gt;&amp;quot;TestEmail@email.com&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   8:  &lt;/span&gt;        Target.Password = &lt;span class=&quot;str&quot;&gt;&amp;quot;TestPass&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   9:  &lt;/span&gt;        Target.ConfirmPassword = &lt;span class=&quot;str&quot;&gt;&amp;quot;TestPass&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  10:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  11:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  12:  &lt;/span&gt;    [Test]&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  13:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; Passed_Validation_Test()&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  14:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  15:  &lt;/span&gt;        Assert.IsTrue(Actual);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  16:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  17:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  18:  &lt;/span&gt;    [Test]&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  19:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; Has_No_ValidationMessages_Test()&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  20:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  21:  &lt;/span&gt;        Assert.IsFalse(ActualMessages.Any());&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  22:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  23:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The model validation requires we have a valid email, we have a password, a confirm password, and password and confirm password match, in this case everything is good and we get a true for is valid and no validation massages.&lt;/p&gt;

&lt;p&gt;Next lets test an invalid model&lt;/p&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;style type=&quot;text/css&quot;&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, &quot;Courier New&quot;, courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #a31515; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}

.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;div class=&quot;csharpcode&quot;&gt;
  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   1:  &lt;/span&gt;[TestFixture]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   2:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;class&lt;/span&gt; When_Testing_RegisterViewModel_Validation_With_NoPassword_Test : ViewModelValidation_Context&amp;lt;RegisterViewModel&amp;gt;&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   3:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   4:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; Context()&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   5:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   6:  &lt;/span&gt;        &lt;span class=&quot;kwrd&quot;&gt;base&lt;/span&gt;.Context();&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   7:  &lt;/span&gt;        Target.Email = &lt;span class=&quot;str&quot;&gt;&amp;quot;TestEmail@email.com&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   8:  &lt;/span&gt;        Target.Password = &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;.Empty;&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   9:  &lt;/span&gt;        Target.ConfirmPassword = &lt;span class=&quot;str&quot;&gt;&amp;quot;TestPass&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  10:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  11:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  12:  &lt;/span&gt;    [Test]&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  13:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; Fail_Validation_Test()&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  14:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  15:  &lt;/span&gt;        Assert.IsFalse(Actual);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  16:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  17:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  18:  &lt;/span&gt;    [Test]&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  19:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; Has_No_ValidationMessages_Test()&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  20:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  21:  &lt;/span&gt;        Assert.IsTrue(ActualMessages.Any());&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  22:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  23:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  24:  &lt;/span&gt;    [TestCase(&lt;span class=&quot;str&quot;&gt;&amp;quot;The Password field is required.&amp;quot;&lt;/span&gt;)]&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  25:  &lt;/span&gt;    [TestCase(&lt;span class=&quot;str&quot;&gt;&amp;quot;The password and confirmation password do not match.&amp;quot;&lt;/span&gt;)]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  26:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; Has_Expected_Validation_ErrorMessages_Test(&lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; message)&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  27:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  28:  &lt;/span&gt;        Assert.IsTrue(ActualMessages.Any(x=&amp;gt;x.ErrorMessage== message));&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  29:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  30:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  31:  &lt;/span&gt;    [TestCase(&lt;span class=&quot;str&quot;&gt;&amp;quot;Password&amp;quot;&lt;/span&gt;)]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  32:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; Has_Expected__ValidationMessages_Test(&lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; memberName)&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  33:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  34:  &lt;/span&gt;        Assert.IsTrue(ActualMessages.Any(x =&amp;gt; x.MemberNames.Contains(memberName)));&lt;/pre&gt;

  &lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  35:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  36:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;In this test we made password an empty string and as a result it failed validation, and returned a validation message for password being required and for password and confirm password not matching.&lt;/p&gt;

&lt;p&gt;Check out my &lt;a href=&quot;https://github.com/bobtjanitor/bob-the-janitor-sample-code/tree/master/SampleApplication&quot;&gt;sample application&lt;/a&gt; on Github to see this in action. &lt;/p&gt;</description><link>http://bob-the-janitor.blogspot.com/2016/02/unit-testing-aspnet-mvc-view-model.html</link><author>noreply@blogger.com (Bob The Janitor)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-1110147073951705771</guid><pubDate>Thu, 18 Feb 2016 18:55:00 +0000</pubDate><atom:updated>2016-02-18T11:55:28.089-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Best Practices</category><category domain="http://www.blogger.com/atom/ns#">Development</category><category domain="http://www.blogger.com/atom/ns#">Enterprise</category><category domain="http://www.blogger.com/atom/ns#">Security</category><title>I agree With Apple and San Bernardino County is at fault</title><description>&lt;p&gt;There is currently a court case in San Bernardino where the FBI is attempting to compel Apple to build an update to IOS that would allow them to access encrypted data on the work phone of Syed Rizwan Farook (Farook and his wife Tashfeen Malik were responsible, authorities say, for killing 14 people and injuring another 22 who were attending a training event and holiday party last December 2 ).&amp;#160; &lt;/p&gt;  &lt;p&gt;The FBI has requested and has been granted by Magistrate Sheri Pym, in the US District Court of Central California, a court order to force Apple to provide the FBI with software to defeat a self-destruct mechanism on the iPhone. Under the pretense that the phone belongs to the county and the county has the right to access any and all information on their device. To this Tim Cook (CEO of Apple) responded with an &lt;a href=&quot;https://www.apple.com/customer-letter/&quot;&gt;open letter&lt;/a&gt; to their customers saying they will not comply with the court order.&amp;#160; Apple is not disobeying the court order because it supports murdering terrorists, but because they value the rights of their users and are not going to deliberately circumvent their security.&amp;#160; &lt;/p&gt;  &lt;p&gt;In a statements to Fox News one of the against working the San Bernardino case as stated “Nobody can build a phone that we cannot get in under unique circumstances. Why should Apple be allowed to build a phone that does that?” and&amp;#160; “The right should not supersede our ability to keep people safe. It’s why we are not finding others, encryption, and, specifically in this case, we cannot connect the dots.” &lt;a href=&quot;http://www.foxnews.com/us/2016/02/17/apple-must-help-fbi-hack-san-bernardino-killers-phone-judge-says.html&quot;&gt;source&lt;/a&gt;.&amp;#160; Here is where the DOJ, the FBI and the Judge is wrong and Apple is right.&amp;#160; “Our Rights” to not self-incriminate do supersede, and are guaranteed by the constitution.&amp;#160; To make this a little more clear the court order is basically the same as getting a court order to force &lt;a href=&quot;http://www.masterlock.com/&quot;&gt;MasterLock&lt;/a&gt; to update all of their padlocks to use a master key so the government can open them if they need to.&amp;#160; &lt;/p&gt;  &lt;p&gt;Regardless of who owns what is being locked, by forcing a company to add security vulnerabilities to their products is wrong, reckless, and fundamentally against everything our country was founded on.&amp;#160; I understand the DOJ’s position but they are wrong.&amp;#160; &lt;/p&gt;  &lt;p&gt;Why San Bernardino is at fault, if you are going to issue devices as a company/government entity (this was a work phone) you should be managing your hardware to protect your assets, this is the basic bus factor.&amp;#160; If an employee has a company device, the company owns it, and everything on it.&amp;#160; Outside of this case what happens if an employee has valuable company information on a device and the person is in a car wreak?&amp;#160; Digital assets, like all assets, need to be managed correctly, the device manufacture should not be forced to weaken their product for your bad planning.&lt;/p&gt;</description><link>http://bob-the-janitor.blogspot.com/2016/02/i-agree-with-apple-and-san-bernardino.html</link><author>noreply@blogger.com (Bob The Janitor)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-1572014143439400363</guid><pubDate>Mon, 23 Mar 2015 15:33:00 +0000</pubDate><atom:updated>2015-05-19T11:30:13.767-06:00</atom:updated><title>Enterprise Design Patterns and Practices (Boise Code Camp 2015)</title><description>At this years Boise Code Camp I presented on Enterprise Design Patterns and Practices, afterwords I was ask to post my slide deck and notes, if there is interest I&#39;m thinking of doing a blog series on this.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoTitle&quot;&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h1&gt;
Fundamental principals &lt;o:p&gt;&lt;/o:p&gt;&lt;/h1&gt;
&lt;h2&gt;
&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;S.O.L.I.D. Principals&lt;/h2&gt;
&lt;h2&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/h2&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span class=&quot;Heading3Char&quot;&gt;&lt;span style=&quot;font-size: 12.0pt; line-height: 107%;&quot;&gt;S - &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Single_responsibility_principle&quot; title=&quot;Single responsibility principle&quot;&gt;&lt;span class=&quot;Heading3Char&quot;&gt;&lt;span style=&quot;font-size: 12.0pt; line-height: 107%; text-decoration: none; text-underline: none;&quot;&gt;Single responsibility principle&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l2 level1 lfo8; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt; font-stretch: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;A class/method/tier should have only a single
responsibility it should do one thing, and do it well, even if that is telling
other things what to do.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span class=&quot;Heading3Char&quot;&gt;&lt;span style=&quot;font-size: 12.0pt; line-height: 107%;&quot;&gt;O - &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Open/closed_principle&quot; title=&quot;Open/closed principle&quot;&gt;&lt;span class=&quot;Heading3Char&quot;&gt;&lt;span style=&quot;font-size: 12.0pt; line-height: 107%; text-decoration: none; text-underline: none;&quot;&gt;Open/closed
principle&lt;/span&gt;&lt;/span&gt;&lt;/a&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo7; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt; font-stretch: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;Software entities should be open for extension,
but closed for modification, and always favor extension over inheritance. &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span class=&quot;Heading3Char&quot;&gt;&lt;span style=&quot;font-size: 12.0pt; line-height: 107%;&quot;&gt;L - &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Liskov_substitution_principle&quot; title=&quot;Liskov substitution principle&quot;&gt;&lt;span class=&quot;Heading3Char&quot;&gt;&lt;span style=&quot;font-size: 12.0pt; line-height: 107%; text-decoration: none; text-underline: none;&quot;&gt;Liskov substitution principle&lt;/span&gt;&lt;/span&gt;&lt;/a&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l4 level1 lfo6; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt; font-stretch: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;Design by contract, you should never need to
care what the object really is.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span class=&quot;Heading3Char&quot;&gt;&lt;span style=&quot;font-size: 12.0pt; line-height: 107%;&quot;&gt;I - &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Interface_segregation_principle&quot; title=&quot;Interface segregation principle&quot;&gt;&lt;span class=&quot;Heading3Char&quot;&gt;&lt;span style=&quot;font-size: 12.0pt; line-height: 107%; text-decoration: none; text-underline: none;&quot;&gt;Interface segregation principle&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l5 level1 lfo5; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt; font-stretch: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;Using multiple client-specific interfaces are
better than one general-purpose interface.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span class=&quot;Heading3Char&quot;&gt;&lt;span style=&quot;font-size: 12.0pt; line-height: 107%;&quot;&gt;D - &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Dependency_inversion_principle&quot; title=&quot;Dependency inversion principle&quot;&gt;&lt;span class=&quot;Heading3Char&quot;&gt;&lt;span style=&quot;font-size: 12.0pt; line-height: 107%; text-decoration: none; text-underline: none;&quot;&gt;Dependency inversion principle&lt;/span&gt;&lt;/span&gt;&lt;/a&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l3 level1 lfo4; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt; font-stretch: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;Depend use abstractions and not concreate
implementations. Use a factory pattern, DI container, Lazy Load properties,
etc.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
These are the fundamental principles of OO development and
apply equally for application architecture.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
Be strongly typed and loosely coupled &lt;o:p&gt;&lt;/o:p&gt;&lt;/h2&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
By creating strongly typed interactions between objects you
are enforcing a consistent behavior that will help prevent difficult to find
runtime errors.&amp;nbsp; Decoupling objects in
your application allows you to change the underlying object without the
changing the caller. &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
The 2 biggest problems you will face&lt;o:p&gt;&lt;/o:p&gt;&lt;/h2&gt;
&lt;h3&gt;
Golden Hammer&lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Having go to tools are great, but just because something can
do it, doesn&#39;t mean it should be used.&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h3&gt;
Silver Bullets&lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Everything from here on down may/can/possibly help, but
will not solve all of your problems, always looking for the next technology to solve all of your problems will only end in pain. &amp;nbsp;These are tools in a toolbox, to be used appropriately.&amp;nbsp; If used incorrectly they will bring pain, lot
of pain.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
Automation, Automation, Automation&lt;o:p&gt;&lt;/o:p&gt;&lt;/h2&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
If it can be reasonably automated, it should be, Computers
are really good at being consistent, and humans are not&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h3&gt;
Build server &amp;amp; source control &lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Nothing fundamentally improve your code more. (Jenkins, TFS,
Team City, Bamboo, Apache Continuum, etc.) Nothing goes out that isn&#39;t in
source control, EVER! &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h3&gt;
Application Deployment &lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Using deployment tools for pushing changes (MSDeploy,
Octopus, etc.), copy past in not a recommended deployment methodology.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h3&gt;
Database Deployment/Migration&lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Database changes are code changes too. &amp;nbsp;Use a migration framework (EF Migrations,
Fluent Migrations, etc.) or a database change management tool (Visual Studio
Database Project, Redgate tools, DB Deploy, Ready Roll, etc.)&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h3&gt;
Testing &lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Automating your unit, behavior, integration, load and UX
tests allows you to find problems before your clients/customers.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
Instrumentation &lt;o:p&gt;&lt;/o:p&gt;&lt;/h2&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Regardless of what you think might be going on, without
instrumentation your blind.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h3&gt;
Logging&lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
This is the first and easiest way to find out what is going
on under the hood, don’t write your own! Unless you really need to (log4net,
nLog, Enterprise Library, SmartInspect, etc.)&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h3&gt;
Memory Profiler &lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
While a logger can tell you what is going on in the code, a
memory profiler (redgate ants, JetBrains Memory Profiler, etc.)&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h3&gt;
Site monitoring and Analytics&lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Just because your application is live doesn&#39;t mean you can
stop paying attention to it, knowing how many people are interacting with it,
how they are interacting with it and when will let you know what has happened,
what is currently happening, in order to guess what is going to happen.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
Leveraging 3&lt;sup&gt;rd&lt;/sup&gt; party tools&lt;o:p&gt;&lt;/o:p&gt;&lt;/h2&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Focus on your core features, leverage 3&lt;sup&gt;rd&lt;/sup&gt; party
to deal with the grunt work.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h3&gt;
Abstract your 3&lt;sup&gt;rd&lt;/sup&gt; party includes &lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Using 3&lt;sup&gt;rd&lt;/sup&gt; party tools are great and will save you
from re-inventing the wheel, but to keep from being locked in always abstract
away the implantation when you can.&amp;nbsp; In
the future the library may no longer be supported, licensing problems, etc.
being able to quickly insert a replacement will save you in the long run.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
Building for Extendibility&lt;o:p&gt;&lt;/o:p&gt;&lt;/h2&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Separate your application into logical segments or
tiers.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h3&gt;
n-Tier Design&lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
The 3 major application tiers are (but not limited to) &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;mso-list: l1 level1 lfo1; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt; font-stretch: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;UI – For displaying or transmitting information
(webpage, API endpoint, etc.)&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;mso-list: l1 level1 lfo1; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt; font-stretch: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;Domain or Business – This is where the work and
decisions are made&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;mso-list: l1 level1 lfo1; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt; font-stretch: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;Data Access – Where the data comes from (DB
call, Web Service call, file read, etc.)&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
A very important rule is tiers can only see the tier next to
them, the UI should have no concept of where the data it’s displaying is coming
from, and all it cares about is it made a request from the Domain and got data
back.&amp;nbsp; This applies to the Data Access as
well, all it knows or cares about is returning data requested by the
Domain.&amp;nbsp; This logically separation of
your logic allows you to reuse and refactor your application cleanly without
fear of breaking changes in an outside tier.&amp;nbsp;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h3&gt;
DTO, POCO, and Model objects&lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
With each tier isolated from each other we are going to need
a way to pass information back and forth, enter the DTO (Data Transport
Object).&amp;nbsp; Basically these are classes
that hold information, they have little to no logic and know nothing about
where they are, where they came from, or where they are going. &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h3&gt;
Separate Update, Select and Work Logic&lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Domain classes can get big fast, by keeping them logically
separated into a more singular function is keeping in line with the single
responsibility principal and keep them more manageable.&amp;nbsp; &amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
This can be applied to Data access classes as well even if
it’s as simple as having 2 interfaces on a data repository class, one for
updates and one for selects.&amp;nbsp; This might
seem silly until you start working with publisher and subscriber databases.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h3&gt;
Do not over abstract &lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
While using abstractions to separate and decouple your logic
is good, if overused/abused these good intentions quickly paves a road
abstraction hell.&amp;nbsp; Where adding a single
property to your result set to display requires modifying 5 DTO objects, 4 file
mappers, yes I know of an application that does this. &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h2&gt;
&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/h2&gt;
&lt;h2&gt;
Building for Scalability &lt;o:p&gt;&lt;/o:p&gt;&lt;/h2&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Dealing with Load &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h3&gt;
Caching &amp;nbsp;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;mso-list: l7 level1 lfo2; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt; font-stretch: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;Micro-caching – for lots of requests for the
same data needing relatively real time data(5-10 sec)&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;mso-list: l7 level1 lfo2; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt; font-stretch: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;Memory caching – for things that don’t change that
often (1+ hours): User information, product data, GEO data (city, state, LAT, LOG,
etc.) &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;mso-list: l7 level1 lfo2; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt; font-stretch: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;DB caching – For&amp;nbsp;
sharing your Cache&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h3&gt;
Spreading the Load&lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
With your logic separated and decoupled it’s easy to farm your
pain points to other hardware, think out instead of bigger.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;mso-list: l6 level1 lfo3; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt; font-stretch: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;Move expensive functionality (Encryption,
PDF/Image creation, etc.) to a dedicated system/systems to prevent load on your
main server/servers.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;mso-list: l6 level1 lfo3; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt; font-stretch: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;Using publisher &amp;amp; subscriber data bases, to
reduce the load on your primary database, move selects from the main to the
subscribers, this is also a good practice for reporting servers, running a
massive metrics report for the sales team should not affect production performance.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;mso-list: l6 level1 lfo3; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt; font-stretch: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;Aggregate and pre-process data, just because you
saved the data in a specific DB Schema don’t mean you have to keep it that
way.&amp;nbsp; Having a job that copies data to a
more flattened table for faster searching can greatly improve performance, even
more so when aggregating from a SQL server (MYSQL, MSSQL, Oracle) to NoSQL(
CouchDB, MongoDB, etc)&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h3&gt;
Queuing up &lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
If you don’t require an immediate synchronous response
message queues are a great way to keep your system fast, prevent data loss
(messages persist until client acknowledges receipt), and distribute workload.
Using a Service Bus takes queues to the next level by creating an architecture
for distributing work load. &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h3&gt;
CDN (Content Delivery Network)&lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Keeping your static files fast, having a striped down server
that only serves up static like images, css, JavaScript, etc. these can also be
geo-located for even better performance. &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h3&gt;
Not everything needs to go to the DB or come from it&lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Databases are great for storing data and pulling data but
they aren&#39;t the only solution.&amp;nbsp; Lots of
data submitted by the use doesn&#39;t need to be persisted in the database.&amp;nbsp; There are better ways to localize your site
then storing it in the database.&amp;nbsp; Customer
uploading images are another area where keeping the Meta data in a database is
a good idea but the image itself should probably go to disk to disk (a CDN
would be great for this).&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h3&gt;
Redundancy &lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Hardware fails, systems crash, operating systems need
updating, and redundant systems keep you online.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;a href=&quot;https://www.dropbox.com/s/el3l57dpes514ha/Enterprise%20Design%20Patterns%20and%20Practices.pptx?dl=0&quot; target=&quot;_blank&quot;&gt;Here is the slide deck&amp;nbsp;&lt;/a&gt;&lt;/div&gt;
</description><link>http://bob-the-janitor.blogspot.com/2015/03/enterprise-design-patterns-and.html</link><author>noreply@blogger.com (Bob The Janitor)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-1038503064085618366</guid><pubDate>Tue, 08 Apr 2014 21:35:00 +0000</pubDate><atom:updated>2014-04-08T15:35:15.327-06:00</atom:updated><title>Boise Code Camp 2014</title><description>This year I did a presentation at Boise Code Camp on &quot;Creating Testable Mobile App with MVVMCross, Xamarin, Windows Phone, and Windows Store Apps. &amp;nbsp;At the request of some of the attendees here is my &lt;a href=&quot;http://bob-the-janitor-sample-code.googlecode.com/svn/trunk/MVVMSampleApp/Creating%20Testable%20Mobile%20apps%20with%20MVVM%20Cross,%20Xamarin%20and%20Windows%20Store.pdf&quot;&gt;slide deck&lt;/a&gt;&amp;nbsp;also here is the &lt;a href=&quot;https://bob-the-janitor-sample-code.googlecode.com/svn/trunk/MVVMSampleApp&quot;&gt;source code&lt;/a&gt;.&amp;nbsp;</description><link>http://bob-the-janitor.blogspot.com/2014/04/boise-code-camp-2014.html</link><author>noreply@blogger.com (Bob The Janitor)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-5572669050282186963</guid><pubDate>Thu, 28 Nov 2013 08:22:00 +0000</pubDate><atom:updated>2014-02-05T12:11:47.674-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">Mocking</category><category domain="http://www.blogger.com/atom/ns#">Mono</category><category domain="http://www.blogger.com/atom/ns#">TDD</category><title>Testing un-mockable base class methods</title><description>Working on a project using the Xamarin Framework and came across a problem where I needed to see if a method was being called.&amp;nbsp; The problem was the method was on the base class and was un-mockable&lt;br /&gt;
&lt;br /&gt;
To get around this I used a lazy load property and a delegate to create a wrapper.&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;private&lt;/span&gt; StartActivityDelegate _start;&lt;/pre&gt;
&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060; font-size: 8pt; line-height: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp; 2:&lt;/span&gt;&lt;span style=&quot;font-size: 8pt; line-height: 12pt;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue; font-size: 8pt; line-height: 12pt;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;font-size: 8pt; line-height: 12pt;&quot;&gt; StartActivityDelegate Start&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   4:&lt;/span&gt;     get { &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; _start ?? (_start = StartActivity); }&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   5:&lt;/span&gt;     set { _start = &lt;span style=&quot;color: blue;&quot;&gt;value&lt;/span&gt;; }&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060;&quot;&gt;   6:&lt;/span&gt; }&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum7&quot; style=&quot;color: #606060;&quot;&gt;   7:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum8&quot; style=&quot;color: #606060;&quot;&gt;   8:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;delegate&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; StartActivityDelegate (Type type);&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum9&quot; style=&quot;color: #606060;&quot;&gt;   9:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum10&quot; style=&quot;color: #606060;&quot;&gt;  10:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;protected&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;override&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; OnCreate(Bundle bundle)&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum11&quot; style=&quot;color: #606060;&quot;&gt;  11:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum12&quot; style=&quot;color: #606060;&quot;&gt;  12:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;base&lt;/span&gt;.OnCreate(bundle);&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum13&quot; style=&quot;color: #606060;&quot;&gt;  13:&lt;/span&gt;     Redirect();&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum14&quot; style=&quot;color: #606060;&quot;&gt;  14:&lt;/span&gt; }&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum15&quot; style=&quot;color: #606060;&quot;&gt;  15:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum16&quot; style=&quot;color: #606060;&quot;&gt;  16:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Redirect()&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum17&quot; style=&quot;color: #606060;&quot;&gt;  17:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum18&quot; style=&quot;color: #606060;&quot;&gt;  18:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (Preferences.HasRequired())&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum19&quot; style=&quot;color: #606060;&quot;&gt;  19:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum20&quot; style=&quot;color: #606060;&quot;&gt;  20:&lt;/span&gt;         Start(&lt;span style=&quot;color: blue;&quot;&gt;typeof&lt;/span&gt;(&lt;span style=&quot;font-size: 8pt; line-height: 12pt;&quot;&gt;ClientActivity&lt;/span&gt;&lt;span style=&quot;font-size: 8pt; line-height: 12pt;&quot;&gt;));&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum21&quot; style=&quot;color: #606060;&quot;&gt;  21:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum22&quot; style=&quot;color: #606060;&quot;&gt;  22:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;else&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum23&quot; style=&quot;color: #606060;&quot;&gt;  23:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum24&quot; style=&quot;color: #606060;&quot;&gt;  24:&lt;/span&gt;         Start(&lt;span style=&quot;color: blue;&quot;&gt;typeof&lt;/span&gt;(&lt;span style=&quot;background-color: white; font-size: 8pt; line-height: 12pt;&quot;&gt;SettingsActivity&lt;/span&gt;&lt;span style=&quot;font-size: 8pt; line-height: 12pt;&quot;&gt;));&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum25&quot; style=&quot;color: #606060;&quot;&gt;  25:&lt;/span&gt;     }   &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum26&quot; style=&quot;color: #606060;&quot;&gt;  26:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
To test it you simply set the property in my test class to a test method&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; [TestFixture]&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060;&quot;&gt;   2:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt; When_Starting_SplashScreen_Without_Required_Preferences_Test&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   4:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; SplashActivity Target;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   5:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; Type Actual;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060;&quot;&gt;   6:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; PreferencesMock PreferencesMock;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum7&quot; style=&quot;color: #606060;&quot;&gt;   7:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum8&quot; style=&quot;color: #606060;&quot;&gt;   8:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; TestStartActivity(Type type)&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum9&quot; style=&quot;color: #606060;&quot;&gt;   9:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum10&quot; style=&quot;color: #606060;&quot;&gt;  10:&lt;/span&gt;         Actual = type;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum11&quot; style=&quot;color: #606060;&quot;&gt;  11:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum12&quot; style=&quot;color: #606060;&quot;&gt;  12:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum13&quot; style=&quot;color: #606060;&quot;&gt;  13:&lt;/span&gt;     [SetUp]&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum14&quot; style=&quot;color: #606060;&quot;&gt;  14:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; SetUp()&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum15&quot; style=&quot;color: #606060;&quot;&gt;  15:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum16&quot; style=&quot;color: #606060;&quot;&gt;  16:&lt;/span&gt;         PreferencesMock = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; PreferencesMock { HasRequiredStub = &lt;span style=&quot;color: blue;&quot;&gt;false&lt;/span&gt; };&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum17&quot; style=&quot;color: #606060;&quot;&gt;  17:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum18&quot; style=&quot;color: #606060;&quot;&gt;  18:&lt;/span&gt;         Target = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; SplashActivity { Start = TestStartActivity, Preferences = PreferencesMock };&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum19&quot; style=&quot;color: #606060;&quot;&gt;  19:&lt;/span&gt;         Target.Redirect();&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum20&quot; style=&quot;color: #606060;&quot;&gt;  20:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum21&quot; style=&quot;color: #606060;&quot;&gt;  21:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum22&quot; style=&quot;color: #606060;&quot;&gt;  22:&lt;/span&gt;     [Test]&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum23&quot; style=&quot;color: #606060;&quot;&gt;  23:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Has_Expected_Activity_Test()&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum24&quot; style=&quot;color: #606060;&quot;&gt;  24:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum25&quot; style=&quot;color: #606060;&quot;&gt;  25:&lt;/span&gt;         Assert.AreEqual(&lt;span style=&quot;color: blue;&quot;&gt;typeof&lt;/span&gt;(SettingsActivity), Actual);&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum26&quot; style=&quot;color: #606060;&quot;&gt;  26:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum27&quot; style=&quot;color: #606060;&quot;&gt;  27:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
Next to test that we are calling the base class method we are expecting, we add a new test fixture and use a little reflection to get the method info for each and then compare them&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; [TestFixture]&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060;&quot;&gt;   2:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt; SplashActivity_Tests&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   4:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; SplashActivity Target;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   5:&lt;/span&gt;     &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060;&quot;&gt;   6:&lt;/span&gt;     [SetUp]&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum7&quot; style=&quot;color: #606060;&quot;&gt;   7:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; SetUp()&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum8&quot; style=&quot;color: #606060;&quot;&gt;   8:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum9&quot; style=&quot;color: #606060;&quot;&gt;   9:&lt;/span&gt;         Target = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; SplashActivity();            &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum10&quot; style=&quot;color: #606060;&quot;&gt;  10:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum11&quot; style=&quot;color: #606060;&quot;&gt;  11:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum12&quot; style=&quot;color: #606060;&quot;&gt;  12:&lt;/span&gt;     [Test]&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum13&quot; style=&quot;color: #606060;&quot;&gt;  13:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; LazyLoads_Write_Test()&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum14&quot; style=&quot;color: #606060;&quot;&gt;  14:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum15&quot; style=&quot;color: #606060;&quot;&gt;  15:&lt;/span&gt;         MethodInfo actual = Target.Start.GetMethodInfo();&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum16&quot; style=&quot;color: #606060;&quot;&gt;  16:&lt;/span&gt;         MethodInfo expected = &lt;span style=&quot;color: blue;&quot;&gt;typeof&lt;/span&gt;(Activity).GetMethod(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;StartActivity&quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum17&quot; style=&quot;color: #606060;&quot;&gt;  17:&lt;/span&gt;         Assert.AreSame(expected, actual);&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum18&quot; style=&quot;color: #606060;&quot;&gt;  18:&lt;/span&gt;     }      &lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum19&quot; style=&quot;color: #606060;&quot;&gt;  19:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://bob-the-janitor.blogspot.com/2013/11/testing-un-mockable-base-class-methods.html</link><author>noreply@blogger.com (Bob The Janitor)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-7591376293108875123</guid><pubDate>Wed, 16 Oct 2013 20:09:00 +0000</pubDate><atom:updated>2013-10-16T14:09:00.393-06:00</atom:updated><title>Steps for shortening the “Feedback Loop”</title><description>&lt;div class=&quot;MsoNormal&quot;&gt;
Information is the basic building block of software
development and the most valuable form of information is useful feedback.&amp;nbsp; Feedback can come from the customer, the
application’s users, and the development team.&amp;nbsp;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Regardless of the development methodology used the feedback
loop is going to follow this basic flow&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKLnrwuCfRcvBmA83b-xPGD1WMXffRxzYYAnhvXVmI2TnbqBP8FHbQl1MmvcMiwiImqa5jODm_qWxrY4IOC_oKK-M2SaPCWrQDLT8N69ZVbVCxHlFmBCE9ZqVcakVlNRZgcx8ZkMr7zhU/s1600/FeedbackLoop.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;331&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKLnrwuCfRcvBmA83b-xPGD1WMXffRxzYYAnhvXVmI2TnbqBP8FHbQl1MmvcMiwiImqa5jODm_qWxrY4IOC_oKK-M2SaPCWrQDLT8N69ZVbVCxHlFmBCE9ZqVcakVlNRZgcx8ZkMr7zhU/s400/FeedbackLoop.PNG&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Looking at the Waterfall Methodology it’s very easy to see
why it has become dated.&amp;nbsp; When you look at
the basic flow&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNRcJutjXObTgvMlkc3r9zS7LrvYL8qyEegi2iZD1IINvuG8X565-O6_qOvioFF9Z06YzeCaqhLb6Adp0iQs2PfP97fvUJ6etZn5bcB68vON4ELT9KivNj-46g3Fs2KLU7piyScXUcRvc/s1600/WaterFall.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;346&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNRcJutjXObTgvMlkc3r9zS7LrvYL8qyEegi2iZD1IINvuG8X565-O6_qOvioFF9Z06YzeCaqhLb6Adp0iQs2PfP97fvUJ6etZn5bcB68vON4ELT9KivNj-46g3Fs2KLU7piyScXUcRvc/s400/WaterFall.PNG&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
The first opportunity for the developers to get feedback is
at the end of the Verification stage.&amp;nbsp;&amp;nbsp; Depending
on the size of the project the Feedback Loop for Water Fall can take a couple
of months to over a year.&amp;nbsp; This large gap
between gathering requirements and implementing them makes it very difficult
and costly to fix misunderstood or faulty requirements.&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
What if the oil light in your car only gave you feed back
every 30 min?&amp;nbsp;&amp;nbsp; If you lose your drain
plug, 30 min. is a long time to run without oil.&amp;nbsp; Software development is the same way, unless
you’re getting regular feedback you won’t know something has gone wrong until
it’s too late and you face costly refactors.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
The hardest part of shortening the Feed Back loop is getting
started.&amp;nbsp; It takes not only a change in
behavior but also in thinking. &amp;nbsp;To quote
a great American writer&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;a href=&quot;http://d202m5krfqbpi5.cloudfront.net/authors/1322103868p5/1244.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;http://d202m5krfqbpi5.cloudfront.net/authors/1322103868p5/1244.jpg&quot; width=&quot;142&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoTableGrid&quot; style=&quot;border-collapse: collapse; border: none; mso-border-insidev: none; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 1184;&quot;&gt;
 &lt;tbody&gt;
&lt;tr style=&quot;height: 25.15pt; mso-yfti-firstrow: yes; mso-yfti-irow: 0; mso-yfti-lastrow: yes;&quot;&gt;
  &lt;td style=&quot;height: 25.15pt; padding: 0in 5.4pt 0in 5.4pt; width: 59.4pt;&quot; valign=&quot;top&quot; width=&quot;79&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; color: #666600; font-family: &amp;quot;Georgia&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 10.5pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-no-proof: yes; text-decoration: none; text-underline: none;&quot;&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shapetype
   id=&quot;_x0000_t75&quot; coordsize=&quot;21600,21600&quot; o:spt=&quot;75&quot; o:preferrelative=&quot;t&quot;
   path=&quot;m@4@5l@4@11@9@11@9@5xe&quot; filled=&quot;f&quot; stroked=&quot;f&quot;&gt;
   &lt;v:stroke joinstyle=&quot;miter&quot;/&gt;
   &lt;v:formulas&gt;
    &lt;v:f eqn=&quot;if lineDrawn pixelLineWidth 0&quot;/&gt;
    &lt;v:f eqn=&quot;sum @0 1 0&quot;/&gt;
    &lt;v:f eqn=&quot;sum 0 0 @1&quot;/&gt;
    &lt;v:f eqn=&quot;prod @2 1 2&quot;/&gt;
    &lt;v:f eqn=&quot;prod @3 21600 pixelWidth&quot;/&gt;
    &lt;v:f eqn=&quot;prod @3 21600 pixelHeight&quot;/&gt;
    &lt;v:f eqn=&quot;sum @0 0 1&quot;/&gt;
    &lt;v:f eqn=&quot;prod @6 1 2&quot;/&gt;
    &lt;v:f eqn=&quot;prod @7 21600 pixelWidth&quot;/&gt;
    &lt;v:f eqn=&quot;sum @8 21600 0&quot;/&gt;
    &lt;v:f eqn=&quot;prod @7 21600 pixelHeight&quot;/&gt;
    &lt;v:f eqn=&quot;sum @10 21600 0&quot;/&gt;
   &lt;/v:formulas&gt;
   &lt;v:path o:extrusionok=&quot;f&quot; gradientshapeok=&quot;t&quot; o:connecttype=&quot;rect&quot;/&gt;
   &lt;o:lock v:ext=&quot;edit&quot; aspectratio=&quot;t&quot;/&gt;
  &lt;/v:shapetype&gt;&lt;v:shape id=&quot;Picture_x0020_5&quot; o:spid=&quot;_x0000_i1025&quot; type=&quot;#_x0000_t75&quot;
   alt=&quot;Mark Twain&quot;
   href=&quot;http://www.goodreads.com/author/show/1244.Mark_Twain&quot; style=&#39;width:37.5pt;
   height:49.5pt;visibility:visible;mso-wrap-style:square&#39; o:button=&quot;t&quot;&gt;
   &lt;v:fill o:detectmouseclick=&quot;t&quot;/&gt;
   &lt;v:imagedata src=&quot;file:///C:\Users\Richard\AppData\Local\Temp\msohtmlclip1\01\clip_image001.jpg&quot;
    o:title=&quot;Mark Twain&quot;/&gt;
  &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;!--[endif]--&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;height: 25.15pt; padding: 0in 5.4pt 0in 5.4pt; width: 419.4pt;&quot; valign=&quot;top&quot; width=&quot;559&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #181818; font-family: &amp;quot;Georgia&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 10.5pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-font-kerning: 18.0pt;&quot;&gt;“The secret of getting ahead is
  getting started. The secret of getting started is breaking your complex
  overwhelming tasks into small manageable tasks, and starting on the first
  one.”&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 13.5pt; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #181818; font-family: &amp;quot;Georgia&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 10.5pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;br /&gt;
  ―&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://www.goodreads.com/author/show/1244.Mark_Twain&quot;&gt;&lt;span style=&quot;color: #666600; font-family: &amp;quot;Georgia&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 10.5pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Mark
  Twain&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #181818; font-family: &amp;quot;Georgia&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 10.5pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3&gt;
Step 1: Short Development Iterations&lt;/h3&gt;
&lt;h2&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/h2&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
A project may look large and complex but keep in mind the
Egyptian Pyramids where built one block at a time.&amp;nbsp; By breaking tasks down into more manageable
items you are able to focus on very specific requirements and get feedback on
that specific requirement.&amp;nbsp; I personally
like 2-week iterations; it’s enough time to get things done, without getting
lost in the details.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h3&gt;
Step 2: Work in Small Teams&amp;nbsp; &lt;/h3&gt;
&lt;h2&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/h2&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
The old adage “too many cooks spoil the broth” is just as
true in software development.&amp;nbsp; Large
teams have the same problems that large tasks do; there is too much going
on.&amp;nbsp; Large teams require too much
coordination, reduce individual responsibility, and only the most vocal get
heard. &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
It has been my experience that three to five developers
works best.&amp;nbsp; With fewer developers the
team can lack skill set diversity, and with more you run into coordination and
crowd mentality issues.&amp;nbsp; Never have a
team of one.&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h3&gt;
Step 3: Test Driven Development &lt;/h3&gt;
&lt;h2&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/h2&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Test Driven Development (TDD) is creating software tests to
verify requirements, and then writing the software to perform that
behavior.&amp;nbsp; This provides the developer
with a personal feedback loop to know that what is being created has the
expected result.&amp;nbsp; This also provides the
added benefit of built in regression tests.&amp;nbsp;&amp;nbsp;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h3&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Cambria, serif; font-size: 13pt; line-height: 115%;&quot;&gt;Step 4:
Continuous Integration&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Continuous Integration (CI) is the process of merging code
as soon as possible and running tests to verify everything is working as
expected.&amp;nbsp; CI can be done manually but is
more commonly done with a build server such as Team City, Jenkins, TFS, or
others.&amp;nbsp; This quickly gives software
developers feedback regarding overlapping work, quality control, and overall
code health.&amp;nbsp; This step will quantifiablly improve the quality of your code more than any other single task you do.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h3&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Cambria, serif; font-size: 13pt; line-height: 115%;&quot;&gt;Step 5:
Automate as much as possible &lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
When automating tasks you are going to get quicker feedback,
a consistent behavior, inherent documentation (by way of the automation
script), and reduces overall costs by freeing up resources to work on more
important tasks.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>http://bob-the-janitor.blogspot.com/2013/10/steps-for-shortening-feedback-loop.html</link><author>noreply@blogger.com (Bob The Janitor)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKLnrwuCfRcvBmA83b-xPGD1WMXffRxzYYAnhvXVmI2TnbqBP8FHbQl1MmvcMiwiImqa5jODm_qWxrY4IOC_oKK-M2SaPCWrQDLT8N69ZVbVCxHlFmBCE9ZqVcakVlNRZgcx8ZkMr7zhU/s72-c/FeedbackLoop.PNG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-8851579349799817409</guid><pubDate>Wed, 09 Oct 2013 19:57:00 +0000</pubDate><atom:updated>2013-10-09T13:57:00.175-06:00</atom:updated><title>Death by Golden Hammer</title><description>&lt;div class=&quot;MsoNormal&quot;&gt;
The old adage “When all you have is a hammer, every problem
looks like a nail.” is a very common problem in the software development
world.&amp;nbsp; Developers may become proficient
with a particular technology or tool set and use it to every problem, even to the
point of excluding a more appropriate solution.&amp;nbsp;
This narrow technological view has been nicknamed, “The Golden Hammer”.&amp;nbsp; There are benefits to having a very deep
understanding of a specific technology stack, however t is more important to
understand when to use an alternative.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
A common Golden Hammer is using programing languages in ways
they were never intended to be used.&amp;nbsp; For
example, in the late 90’s the Perl programing language was very popular, and to
some extent still is. With good reason, it’s an incredibly powerful and useful
scripting language.&amp;nbsp; It was originally
created for parsing text, which it’s really good at it.&amp;nbsp; It was so good at doing what it did, that
people became very adept at it, and started using it for things it was never
really intended to do; such as writing full applications.&amp;nbsp; Being a scripting language created for simple
text parsing, its syntax was very loose and lacked the structure needed to
create well formatted and maintainable code.&amp;nbsp;
In spite of its shortcomings it was used far more than it should have
been.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Another common Golden Hammer is using tools like Microsoft
SharePoint or a content management system (CMS) such as:WordPress as a
development platform.&amp;nbsp; These tools were
built with the intent of managing content, and for the most part they do that
very well.&amp;nbsp; The down side is when you
start extending these tools beyond their intended use.&amp;nbsp; Using Microsoft SharePoint to build a
warehouse order management system is like building a drag racer out of a school
bus.&amp;nbsp; I’ve seen both done and it’s a
prime example of “just because you can doesn’t mean you should.”&amp;nbsp; You can force tools to do what you want them
to do, but it’s going to take a lot of customization and your end product, like
the drag racing school bus, will never perform as well as if you had built it
with the appropriate solution.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
When looking at what tools and technology to use it’s just
as important to look at what not to use.&amp;nbsp;
One of the most valuable lessons I learned in high school was from my shop
teacher:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoQuote&quot;&gt;
&lt;i&gt;“Learn to use the right tool for the job, not what’s most
convenient. Screwdrivers are not chisels!” &lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoQuote&quot;&gt;
&lt;i&gt;Dallas E. Tolman&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoQuote&quot;&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWX0J0bdSA1BvAB-MNrKjNJMz8OU496Hc9589XPR2lIU5baLRktJbdQumEnKEgFMDJBn92zYKYXMpKQA_pEROplMw4A84b320qnRNfkvAPVOSlRkWJw2PMtNiIItKVsGWYZlrOZflBxoM/s1600/ScrewDriverInjery.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;302&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWX0J0bdSA1BvAB-MNrKjNJMz8OU496Hc9589XPR2lIU5baLRktJbdQumEnKEgFMDJBn92zYKYXMpKQA_pEROplMw4A84b320qnRNfkvAPVOSlRkWJw2PMtNiIItKVsGWYZlrOZflBxoM/s320/ScrewDriverInjery.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
In the long run you will always be better off using the
right tool vs. the most convenient one.&amp;nbsp;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
</description><link>http://bob-the-janitor.blogspot.com/2013/10/death-by-golden-hammer.html</link><author>noreply@blogger.com (Bob The Janitor)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWX0J0bdSA1BvAB-MNrKjNJMz8OU496Hc9589XPR2lIU5baLRktJbdQumEnKEgFMDJBn92zYKYXMpKQA_pEROplMw4A84b320qnRNfkvAPVOSlRkWJw2PMtNiIItKVsGWYZlrOZflBxoM/s72-c/ScrewDriverInjery.PNG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-4755770234729695019</guid><pubDate>Mon, 07 Oct 2013 19:54:00 +0000</pubDate><atom:updated>2013-10-09T13:14:55.680-06:00</atom:updated><title>Having the right tools can make all the difference </title><description>&lt;div class=&quot;MsoNormal&quot;&gt;
The ability to make
and use tools is what separates humans from the rest of the animal kingdom;
having said that, there is a difference between having a tool and knowing how
to use it.&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
When not developing
software, I’m a woodworker. When I started building things, one of the first
lessons I learned is that spending the money to get quality tools will save you
money in the long run.&amp;nbsp; Chisels made from
high quality steel can be made sharper, and will hold an edge longer, allowing
the user to make cleaner cuts and reduce waste in materials and effort.&amp;nbsp; Quality development tools can do the same
thing, with tools like intelli-sense, reference navigation, and auto test
runners; we reduce the labor of development thus reducing the cost. The
licensing for Visual Studio, Resharper, and NCrunch may look expensive until
you look at the amount of time saved not having to wait for tests to run, not
having to hunt through file after file when a method name is updated, etc.&amp;nbsp;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
</description><link>http://bob-the-janitor.blogspot.com/2013/10/having-right-tools-can-make-all.html</link><author>noreply@blogger.com (Bob The Janitor)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-4480914943951545290</guid><pubDate>Wed, 09 Jan 2013 06:33:00 +0000</pubDate><atom:updated>2013-01-08T23:33:05.984-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Best Practices</category><category domain="http://www.blogger.com/atom/ns#">Mocking</category><category domain="http://www.blogger.com/atom/ns#">TDD</category><category domain="http://www.blogger.com/atom/ns#">Tools</category><title>Tools only give you the ability</title><description>Recently I read a post on the Alt.net linked-in group &lt;a href=&quot;http://www.linkedin.com/groupItem?view=&amp;amp;gid=36509&amp;amp;type=member&amp;amp;item=143838668&quot;&gt;Would mocking help prevent these software bugs?&lt;/a&gt; talking about the Knight Capital Group Inc.’s disaster, asking the question &quot;if doing more testing and using mocks would have prevented it?&quot;&lt;br /&gt;
&lt;br /&gt;
Doing unit testing with mocking is a tool, not a silver bullet. Unit tests mixed with behavior testing can be very effective at finding these kinds of bugs and Mocks allow you to create and test against foreseen conditions.&amp;nbsp; While TDD can help expose bugs, unforeseen data conditions can pass though unnoticed, tests only test what they are told to.&lt;br /&gt;
&lt;br /&gt;
Something else to keep in mind is behavior and unit tests are only a small part of the testing tool box that also includes: integration tests, performance tests, automated UI tests, etc.&amp;nbsp; and that’s what these are tools.&amp;nbsp; How effective they are depends on the user, a funny quote I once heard is “A tool runs tools, a craftsman uses them”.&amp;nbsp; You can run your code coverage tool all day long and say “look I have 80% code coverage” but this doesn&#39;t mean your code is well tested, it just means it has test that run though it, and can hide untested code.&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
One commenter on the article said something to the effect that what they where working on requires to much performance to be testable.&amp;nbsp;&amp;nbsp; I would like to state this is B.S. you can make testable code that has just as much performance as not testable code. You may have to change how you test the code, or use different design or testing techniques for example Dependency Injection isn&#39;t required to make testable code, if it&#39;s not fast enough use greedy constructors or lazy load properties. If you need to make a black box class for performance, you simply do integration tests around it.&lt;br /&gt;
&lt;br /&gt;
In the end, saying TDD isn’t of value because it didn’t catch bug xyz is like a carpenter blaming his hammer for hitting his thumb and not the nail.&amp;nbsp; On the other side it’s just as ridiculous to say “I can build a house” simply because you own a hammer and some nails.</description><link>http://bob-the-janitor.blogspot.com/2013/01/tools-only-give-you-ability.html</link><author>noreply@blogger.com (Bob The Janitor)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-723933800162974684</guid><pubDate>Wed, 17 Oct 2012 20:04:00 +0000</pubDate><atom:updated>2012-10-22T22:11:45.627-06:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Best Practices</category><category domain="http://www.blogger.com/atom/ns#">Pair Programing</category><category domain="http://www.blogger.com/atom/ns#">Teamwork</category><title>Keep contention out of collaboration</title><description>&lt;p&gt;There is an old joke “arguing with a developer is like wrestling with a pig in mud, after a while you realizes he/she likes it”, and there are a number of reasons for this, as a group we tend to have strong options,&amp;#160; stubbornness, know-it-all, and ego to name a few.&amp;#160; Some of this is what makes us good developers, a lot of it is what makes us irrigating to other people.&lt;/p&gt;  &lt;p&gt;I personally have been in my fair share of heated, angry, and down right nasty &#39;discussions&#39; and in the past I may have been guilty of using the force of my will to get teams I have been on to do things &#39;The right way&#39;.&amp;#160; Even joking about being the “a-hole developer”, and as I matured as a professional, I realized even if I win like this, at what cost?&amp;#160; I began to realize it was beginning to effect my health and that I didn&#39;t like who I was becoming. &lt;/p&gt;  &lt;p&gt;We talk about the need to collaborate, from pair programming, sprint planning, daily stand ups, retrospectives, etc.&amp;#160; but how often do they turn into arguments?&amp;#160; Recently in the Javascript world there has been a lot of arguing about semicolons, and if they should be required.&amp;#160; In all honesty this is really a non-problem, and yet people are getting brutal and down right offensive, over the need to be right? Being contentious will not change anyone’s mind, if there is a “winner” it’s because the other side has given up, and at what cost?&amp;#160; Both sides are going to be resentful of the other, and it’s going to make working together that much harder.&lt;/p&gt;  &lt;p&gt;This is not to say we can’t have discussions from different points of view, have different opinions, be a pushover, or not think the other side is off their rocker.&amp;#160; Far from it, but we need to keep it civil and positive.&amp;#160; Last I checked we (as developers) are paid to solve problems, not prove we are right.&amp;#160; The heart of collaboration is taking different points of view and coming up with the best solution and we can’t do that if we are trying to prove we are right.&amp;#160;&amp;#160;&amp;#160; &lt;/p&gt;  &lt;p&gt;It’s ok to have strong opinions, I have more then a few, but it is also important be open minded, be willing to look at what the other side is saying, and come to an acceptable resolution on how to solve the problem.&amp;#160; Admitting when you are wrong, or at least not completely right, can be very hard.&amp;#160; Ultimately, be willing to work as a team, and if the team decides to do things “wrong” then that’s what the team wants.&amp;#160; If you are working with a team that insists on doing things “wrong” and you are unable to contribute, then maybe this isn’t the team for you “If you can’t change where you work, change where you work”.&lt;/p&gt;  </description><link>http://bob-the-janitor.blogspot.com/2012/10/keep-contention-out-of-collaboration.html</link><author>noreply@blogger.com (Bob The Janitor)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-1341866295063368553</guid><pubDate>Wed, 27 Jun 2012 08:01:00 +0000</pubDate><atom:updated>2012-06-27T02:01:46.355-06:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">TDD</category><category domain="http://www.blogger.com/atom/ns#">Tools</category><title>Running your test while you write them using NCrunch</title><description>A coworker told me about watching a presentation where the presenter used &lt;a href=&quot;http://www.ncrunch.net/&quot; target=&quot;_blank&quot;&gt;NCrunch&lt;/a&gt;, so I decided to take a look at it.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
The basic idea is NCrunch&amp;nbsp; automatically runs your tests in a parallel process giving you continuous testing that’s integrated into Visual Studio. It intelligently runs tests automatically so that you don&#39;t have to, and gives you useful information including code coverage and performance metrics while you work.&lt;br /&gt;
&lt;br /&gt;
Here is an example of the inline test results&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://lh3.ggpht.com/-6jydmbNwYTM/T-q8VAoAMzI/AAAAAAAAArw/j0zWNEa0hcs/s1600-h/nCrunch_Code%25255B3%25255D.png&quot;&gt;&lt;img alt=&quot;nCrunch_Code&quot; border=&quot;0&quot; height=&quot;227&quot; src=&quot;http://lh6.ggpht.com/-pmvF0rhgwGI/T-q8VkDdH-I/AAAAAAAAAr4/4nhNtMjkfIc/nCrunch_Code_thumb%25255B1%25255D.png?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;nCrunch_Code&quot; width=&quot;524&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
here is a screenshot of the test runner&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://lh4.ggpht.com/-R2vurdYvTRs/T-q8WWIQTYI/AAAAAAAAAsA/caXSEWnKmpI/s1600-h/nCrunch_TestRunner%25255B5%25255D.png&quot;&gt;&lt;img alt=&quot;nCrunch_TestRunner&quot; border=&quot;0&quot; height=&quot;195&quot; src=&quot;http://lh4.ggpht.com/-cbxhQZC-jEo/T-q8XLjBkCI/AAAAAAAAAsI/8q-9_eHWJx4/nCrunch_TestRunner_thumb%25255B3%25255D.png?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;nCrunch_TestRunner&quot; width=&quot;532&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
and this what the coverage looks like&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://lh4.ggpht.com/-1E7GrudlBuY/T-q8Xykq04I/AAAAAAAAAsQ/3idPTh4YY2k/s1600-h/nCrunch_CodeCoverage%25255B3%25255D.png&quot;&gt;&lt;img alt=&quot;nCrunch_CodeCoverage&quot; border=&quot;0&quot; height=&quot;198&quot; src=&quot;http://lh6.ggpht.com/-f1Um0zdtUy0/T-q8YSaiY1I/AAAAAAAAAsY/HB5docYQGyo/nCrunch_CodeCoverage_thumb%25255B1%25255D.png?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;nCrunch_CodeCoverage&quot; width=&quot;533&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
it’s not quite as detailed as I would like, but not bad.&lt;br /&gt;
&lt;br /&gt;
This isn’t going to be a replacement for my copy of Resharper and DotCover but at the same time, I don’t see a problem with running both.&amp;nbsp; This could defiantly save me a lot of time waiting for test to run and if I want more detailed information I can still use dotCover.&lt;br /&gt;
&lt;br /&gt;
This is a free tool that so far has really impressed me, for more information go to the NCrunch home page at&lt;a href=&quot;http://www.ncrunch.net/&quot;&gt;http://www.ncrunch.net/&lt;/a&gt;</description><link>http://bob-the-janitor.blogspot.com/2012/06/running-your-test-while-you-write-them.html</link><author>noreply@blogger.com (Bob The Janitor)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/-pmvF0rhgwGI/T-q8VkDdH-I/AAAAAAAAAr4/4nhNtMjkfIc/s72-c/nCrunch_Code_thumb%25255B1%25255D.png?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-1170808489824932654</guid><pubDate>Mon, 25 Jun 2012 17:59:00 +0000</pubDate><atom:updated>2012-06-25T11:59:39.175-06:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">Mocking</category><category domain="http://www.blogger.com/atom/ns#">moq</category><category domain="http://www.blogger.com/atom/ns#">TDD</category><title>Testing for execution sequence</title><description>I ran into a problem the other day where I was doing some cost calculations and wasn’t getting the expected result, the problem turned out to be I was doing the calculations before everything got loaded, simple mistake. &lt;br /&gt;
&lt;br /&gt;
Thought it would be interesting to show the solution I used for testing, lets say we have a simple method for updating an employee record.&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt; UpdateEmployee(EmployeeDto updateEmployee)&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060;&quot;&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt;     var result = &lt;span style=&quot;color: blue;&quot;&gt;false&lt;/span&gt;;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   4:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;(AuthRequests.UserCanUpdateEmployee(User.Id,updateEmployee.Id))&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   5:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060;&quot;&gt;   6:&lt;/span&gt;         result = EmployeeRepository.UpdateEmployee(updateEmployee);&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum7&quot; style=&quot;color: #606060;&quot;&gt;   7:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum8&quot; style=&quot;color: #606060;&quot;&gt;   8:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; result;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum9&quot; style=&quot;color: #606060;&quot;&gt;   9:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
fairly simple, you call AuthRequests to see if the user and update the employee and then you update the employee.&amp;nbsp; Here is an example test class for it&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; [TestFixture]&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060;&quot;&gt;   2:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt; When_Updating_Employee_Information_Test: Test_Context&amp;lt;EmployeeRequests&amp;gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   4:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; Mock&amp;lt;IAuthRequests&amp;gt; AuthRequestsMock;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   5:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt; ExpectedAuth;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060;&quot;&gt;   6:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; UserId;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum7&quot; style=&quot;color: #606060;&quot;&gt;   7:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; EmployeeId;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum8&quot; style=&quot;color: #606060;&quot;&gt;   8:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt; Actual;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum9&quot; style=&quot;color: #606060;&quot;&gt;   9:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt; Expected;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum10&quot; style=&quot;color: #606060;&quot;&gt;  10:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; EmployeeDto UpdateEmployee;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum11&quot; style=&quot;color: #606060;&quot;&gt;  11:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; EmployeeDto SentEmployee;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum12&quot; style=&quot;color: #606060;&quot;&gt;  12:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; UserDto ExpectedUser;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum13&quot; style=&quot;color: #606060;&quot;&gt;  13:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; Mock&amp;lt;IEmployeeRepository&amp;gt; MockEmployeeRepository;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum14&quot; style=&quot;color: #606060;&quot;&gt;  14:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum15&quot; style=&quot;color: #606060;&quot;&gt;  15:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;override&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Context()&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum16&quot; style=&quot;color: #606060;&quot;&gt;  16:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum17&quot; style=&quot;color: #606060;&quot;&gt;  17:&lt;/span&gt;         &lt;span style=&quot;color: blue;&quot;&gt;base&lt;/span&gt;.Context();&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum18&quot; style=&quot;color: #606060;&quot;&gt;  18:&lt;/span&gt;         UserId = 12;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum19&quot; style=&quot;color: #606060;&quot;&gt;  19:&lt;/span&gt;         EmployeeId = 14;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum20&quot; style=&quot;color: #606060;&quot;&gt;  20:&lt;/span&gt;         Expected = &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum21&quot; style=&quot;color: #606060;&quot;&gt;  21:&lt;/span&gt;         ExpectedAuth = &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum22&quot; style=&quot;color: #606060;&quot;&gt;  22:&lt;/span&gt;         UpdateEmployee = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; EmployeeDto{Id = EmployeeId};&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum23&quot; style=&quot;color: #606060;&quot;&gt;  23:&lt;/span&gt;         Target.User.Id = UserId;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum24&quot; style=&quot;color: #606060;&quot;&gt;  24:&lt;/span&gt;         AuthRequestsMock = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; Mock&amp;lt;IAuthRequests&amp;gt;();&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum25&quot; style=&quot;color: #606060;&quot;&gt;  25:&lt;/span&gt;         MockEmployeeRepository = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; Mock&amp;lt;IEmployeeRepository&amp;gt;();&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum26&quot; style=&quot;color: #606060;&quot;&gt;  26:&lt;/span&gt;         &lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum27&quot; style=&quot;color: #606060;&quot;&gt;  27:&lt;/span&gt;         AuthRequestsMock.Setup(x =&amp;gt; x.UserCanUpdateEmployee(UserId, EmployeeId)).Returns(ExpectedAuth);&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum28&quot; style=&quot;color: #606060;&quot;&gt;  28:&lt;/span&gt;         MockEmployeeRepository.Setup(x =&amp;gt; x.UpdateEmployee(It.IsAny&amp;lt;EmployeeDto&amp;gt;())).Callback&amp;lt;EmployeeDto&amp;gt;(&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum29&quot; style=&quot;color: #606060;&quot;&gt;  29:&lt;/span&gt;             x =&amp;gt; SentEmployee = x).Returns(Expected);&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum30&quot; style=&quot;color: #606060;&quot;&gt;  30:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum31&quot; style=&quot;color: #606060;&quot;&gt;  31:&lt;/span&gt;         Target.AuthRequests = AuthRequestsMock.Object;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum32&quot; style=&quot;color: #606060;&quot;&gt;  32:&lt;/span&gt;         Target.EmployeeRepository = MockEmployeeRepository.Object;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum33&quot; style=&quot;color: #606060;&quot;&gt;  33:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum34&quot; style=&quot;color: #606060;&quot;&gt;  34:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum35&quot; style=&quot;color: #606060;&quot;&gt;  35:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;override&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Because()&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum36&quot; style=&quot;color: #606060;&quot;&gt;  36:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum37&quot; style=&quot;color: #606060;&quot;&gt;  37:&lt;/span&gt;         Actual = Target.UpdateEmployee(UpdateEmployee);&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum38&quot; style=&quot;color: #606060;&quot;&gt;  38:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum39&quot; style=&quot;color: #606060;&quot;&gt;  39:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum40&quot; style=&quot;color: #606060;&quot;&gt;  40:&lt;/span&gt;     [Test]&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum41&quot; style=&quot;color: #606060;&quot;&gt;  41:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Calls_AuthRequests_UserCanUpdateEmployee_Test()&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum42&quot; style=&quot;color: #606060;&quot;&gt;  42:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum43&quot; style=&quot;color: #606060;&quot;&gt;  43:&lt;/span&gt;         AuthRequestsMock.Verify(x=&amp;gt;x.UserCanUpdateEmployee(UserId, EmployeeId), Times.Once());&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum44&quot; style=&quot;color: #606060;&quot;&gt;  44:&lt;/span&gt;     } &lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum45&quot; style=&quot;color: #606060;&quot;&gt;  45:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum46&quot; style=&quot;color: #606060;&quot;&gt;  46:&lt;/span&gt;     [Test]&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum47&quot; style=&quot;color: #606060;&quot;&gt;  47:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Calls_EmployeeRepository_UpdateEmployee_Test()&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum48&quot; style=&quot;color: #606060;&quot;&gt;  48:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum49&quot; style=&quot;color: #606060;&quot;&gt;  49:&lt;/span&gt;         MockEmployeeRepository.Verify(x =&amp;gt; x.UpdateEmployee(It.IsAny&amp;lt;EmployeeDto&amp;gt;()), Times.Once());&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum50&quot; style=&quot;color: #606060;&quot;&gt;  50:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum51&quot; style=&quot;color: #606060;&quot;&gt;  51:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum52&quot; style=&quot;color: #606060;&quot;&gt;  52:&lt;/span&gt;     [Test]&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum53&quot; style=&quot;color: #606060;&quot;&gt;  53:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;  &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Sends_expected_Emplyee_test()&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum54&quot; style=&quot;color: #606060;&quot;&gt;  54:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum55&quot; style=&quot;color: #606060;&quot;&gt;  55:&lt;/span&gt;         Assert.AreEqual(UpdateEmployee.Id, SentEmployee.Id);&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum56&quot; style=&quot;color: #606060;&quot;&gt;  56:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum57&quot; style=&quot;color: #606060;&quot;&gt;  57:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum58&quot; style=&quot;color: #606060;&quot;&gt;  58:&lt;/span&gt;     [Test]&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum59&quot; style=&quot;color: #606060;&quot;&gt;  59:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Returns_Expected_Result_Test()&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum60&quot; style=&quot;color: #606060;&quot;&gt;  60:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum61&quot; style=&quot;color: #606060;&quot;&gt;  61:&lt;/span&gt;         Assert.IsTrue(Actual);&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum62&quot; style=&quot;color: #606060;&quot;&gt;  62:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum63&quot; style=&quot;color: #606060;&quot;&gt;  63:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
the only problem is the tests still pass if the method looks like this&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt; UpdateEmployee(EmployeeDto updateEmployee)&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060;&quot;&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt;     var result = EmployeeRepository.UpdateEmployee(updateEmployee);&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   4:&lt;/span&gt;     AuthRequests.UserCanUpdateEmployee(User.Id,updateEmployee.Id);&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   5:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; result;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060;&quot;&gt;   6:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
so lets add some sequence tests, basically we add a counter and a dictionary&amp;lt;string,int&amp;gt; to record what was executed and it what order using the Moq callback.&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-style: none; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; [TestFixture]&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060;&quot;&gt;   2:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt; When_Updating_Employee_Information_With_sequence_Test : Test_Context&amp;lt;EmployeeRequests&amp;gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   4:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; Mock&amp;lt;IAuthRequests&amp;gt; AuthRequestsMock;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   5:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt; ExpectedAuth;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060;&quot;&gt;   6:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; UserId;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum7&quot; style=&quot;color: #606060;&quot;&gt;   7:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; EmployeeId;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum8&quot; style=&quot;color: #606060;&quot;&gt;   8:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt; Actual;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum9&quot; style=&quot;color: #606060;&quot;&gt;   9:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt; Expected;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum10&quot; style=&quot;color: #606060;&quot;&gt;  10:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; EmployeeDto UpdateEmployee;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum11&quot; style=&quot;color: #606060;&quot;&gt;  11:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; EmployeeDto SentEmployee;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum12&quot; style=&quot;color: #606060;&quot;&gt;  12:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; UserDto ExpectedUser;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum13&quot; style=&quot;color: #606060;&quot;&gt;  13:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; Mock&amp;lt;IEmployeeRepository&amp;gt; MockEmployeeRepository;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum14&quot; style=&quot;color: #606060;&quot;&gt;  14:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; Counter;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum15&quot; style=&quot;color: #606060;&quot;&gt;  15:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; Dictionary&amp;lt;&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;, &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&amp;gt; Sequence; &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum16&quot; style=&quot;color: #606060;&quot;&gt;  16:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum17&quot; style=&quot;color: #606060;&quot;&gt;  17:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;override&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Context()&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum18&quot; style=&quot;color: #606060;&quot;&gt;  18:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum19&quot; style=&quot;color: #606060;&quot;&gt;  19:&lt;/span&gt;         &lt;span style=&quot;color: blue;&quot;&gt;base&lt;/span&gt;.Context();&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum20&quot; style=&quot;color: #606060;&quot;&gt;  20:&lt;/span&gt;         UserId = 12;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum21&quot; style=&quot;color: #606060;&quot;&gt;  21:&lt;/span&gt;         EmployeeId = 14;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum22&quot; style=&quot;color: #606060;&quot;&gt;  22:&lt;/span&gt;         Expected = &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum23&quot; style=&quot;color: #606060;&quot;&gt;  23:&lt;/span&gt;         ExpectedAuth = &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum24&quot; style=&quot;color: #606060;&quot;&gt;  24:&lt;/span&gt;         UpdateEmployee = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; EmployeeDto { Id = EmployeeId };&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum25&quot; style=&quot;color: #606060;&quot;&gt;  25:&lt;/span&gt;         Counter = 0;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum26&quot; style=&quot;color: #606060;&quot;&gt;  26:&lt;/span&gt;         Sequence = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; Dictionary&amp;lt;&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;, &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&amp;gt;();&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum27&quot; style=&quot;color: #606060;&quot;&gt;  27:&lt;/span&gt;         Target.User.Id = UserId;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum28&quot; style=&quot;color: #606060;&quot;&gt;  28:&lt;/span&gt;         AuthRequestsMock = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; Mock&amp;lt;IAuthRequests&amp;gt;();&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum29&quot; style=&quot;color: #606060;&quot;&gt;  29:&lt;/span&gt;         MockEmployeeRepository = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; Mock&amp;lt;IEmployeeRepository&amp;gt;();&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum30&quot; style=&quot;color: #606060;&quot;&gt;  30:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum31&quot; style=&quot;color: #606060;&quot;&gt;  31:&lt;/span&gt;         AuthRequestsMock.Setup(x =&amp;gt; x.UserCanUpdateEmployee(UserId, EmployeeId))&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum32&quot; style=&quot;color: #606060;&quot;&gt;  32:&lt;/span&gt;             .Callback(() =&amp;gt; Sequence.Add(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;AuthRequests.UserCanUpdateEmployee&quot;&lt;/span&gt;, Counter++)).Returns(ExpectedAuth);&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum33&quot; style=&quot;color: #606060;&quot;&gt;  33:&lt;/span&gt;         MockEmployeeRepository.Setup(x =&amp;gt; x.UpdateEmployee(It.IsAny&amp;lt;EmployeeDto&amp;gt;()))&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum34&quot; style=&quot;color: #606060;&quot;&gt;  34:&lt;/span&gt;             .Callback&amp;lt;EmployeeDto&amp;gt;(x =&amp;gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum35&quot; style=&quot;color: #606060;&quot;&gt;  35:&lt;/span&gt;                  {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum36&quot; style=&quot;color: #606060;&quot;&gt;  36:&lt;/span&gt;                     SentEmployee = x;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum37&quot; style=&quot;color: #606060;&quot;&gt;  37:&lt;/span&gt;                     Sequence.Add(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;EmployeeRepository.UpdateEmployee&quot;&lt;/span&gt;, Counter++);&lt;/pre&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;span id=&quot;lnum38&quot; style=&quot;color: #606060; font-size: 8pt; line-height: 12pt;&quot;&gt;&amp;nbsp; 38:&lt;/span&gt;&lt;span style=&quot;font-size: 8pt; line-height: 12pt;&quot;&gt;                                        }).Returns(Expected);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;span id=&quot;lnum39&quot; style=&quot;color: #606060; font-size: 8pt; line-height: 12pt;&quot;&gt;&amp;nbsp; 39:&lt;/span&gt;&lt;span style=&quot;background-color: white; font-size: 8pt; line-height: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum40&quot; style=&quot;color: #606060;&quot;&gt;  40:&lt;/span&gt;         Target.AuthRequests = AuthRequestsMock.Object;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum41&quot; style=&quot;color: #606060;&quot;&gt;  41:&lt;/span&gt;         Target.EmployeeRepository = MockEmployeeRepository.Object;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum42&quot; style=&quot;color: #606060;&quot;&gt;  42:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum43&quot; style=&quot;color: #606060;&quot;&gt;  43:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum44&quot; style=&quot;color: #606060;&quot;&gt;  44:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;override&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Because()&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum45&quot; style=&quot;color: #606060;&quot;&gt;  45:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum46&quot; style=&quot;color: #606060;&quot;&gt;  46:&lt;/span&gt;         Actual = Target.UpdateEmployee(UpdateEmployee);&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum47&quot; style=&quot;color: #606060;&quot;&gt;  47:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum48&quot; style=&quot;color: #606060;&quot;&gt;  48:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum49&quot; style=&quot;color: #606060;&quot;&gt;  49:&lt;/span&gt;     [Test]&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum50&quot; style=&quot;color: #606060;&quot;&gt;  50:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Calls_AuthRequests_UserCanUpdateEmployee_Test()&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum51&quot; style=&quot;color: #606060;&quot;&gt;  51:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum52&quot; style=&quot;color: #606060;&quot;&gt;  52:&lt;/span&gt;         AuthRequestsMock.Verify(x =&amp;gt; x.UserCanUpdateEmployee(UserId, EmployeeId), Times.Once());&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum53&quot; style=&quot;color: #606060;&quot;&gt;  53:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum54&quot; style=&quot;color: #606060;&quot;&gt;  54:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum55&quot; style=&quot;color: #606060;&quot;&gt;  55:&lt;/span&gt;     [Test]&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum56&quot; style=&quot;color: #606060;&quot;&gt;  56:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Calls_AuthRequests_UserCanUpdateEmployee_Inorder_Test()&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum57&quot; style=&quot;color: #606060;&quot;&gt;  57:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum58&quot; style=&quot;color: #606060;&quot;&gt;  58:&lt;/span&gt;         Assert.AreEqual(0, Sequence[&lt;span style=&quot;color: #006080;&quot;&gt;&quot;AuthRequests.UserCanUpdateEmployee&quot;&lt;/span&gt;]);&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum59&quot; style=&quot;color: #606060;&quot;&gt;  59:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum60&quot; style=&quot;color: #606060;&quot;&gt;  60:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum61&quot; style=&quot;color: #606060;&quot;&gt;  61:&lt;/span&gt;     [Test]&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum62&quot; style=&quot;color: #606060;&quot;&gt;  62:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Calls_EmployeeRepository_UpdateEmployee_Test()&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum63&quot; style=&quot;color: #606060;&quot;&gt;  63:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum64&quot; style=&quot;color: #606060;&quot;&gt;  64:&lt;/span&gt;         MockEmployeeRepository.Verify(x =&amp;gt; x.UpdateEmployee(It.IsAny&amp;lt;EmployeeDto&amp;gt;()), Times.Once());&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum65&quot; style=&quot;color: #606060;&quot;&gt;  65:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum66&quot; style=&quot;color: #606060;&quot;&gt;  66:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum67&quot; style=&quot;color: #606060;&quot;&gt;  67:&lt;/span&gt;     [Test]&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum68&quot; style=&quot;color: #606060;&quot;&gt;  68:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Calls_EmployeeRepository_UpdateEmployee_Inorder_Test()&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum69&quot; style=&quot;color: #606060;&quot;&gt;  69:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum70&quot; style=&quot;color: #606060;&quot;&gt;  70:&lt;/span&gt;         Assert.AreEqual(1, Sequence[&lt;span style=&quot;color: #006080;&quot;&gt;&quot;EmployeeRepository.UpdateEmployee&quot;&lt;/span&gt;]);&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum71&quot; style=&quot;color: #606060;&quot;&gt;  71:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum72&quot; style=&quot;color: #606060;&quot;&gt;  72:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum73&quot; style=&quot;color: #606060;&quot;&gt;  73:&lt;/span&gt;     [Test]&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum74&quot; style=&quot;color: #606060;&quot;&gt;  74:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Sends_expected_Emplyee_test()&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum75&quot; style=&quot;color: #606060;&quot;&gt;  75:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum76&quot; style=&quot;color: #606060;&quot;&gt;  76:&lt;/span&gt;         Assert.AreEqual(UpdateEmployee.Id, SentEmployee.Id);&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum77&quot; style=&quot;color: #606060;&quot;&gt;  77:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum78&quot; style=&quot;color: #606060;&quot;&gt;  78:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum79&quot; style=&quot;color: #606060;&quot;&gt;  79:&lt;/span&gt;     [Test]&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum80&quot; style=&quot;color: #606060;&quot;&gt;  80:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Returns_Expected_Result_Test()&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum81&quot; style=&quot;color: #606060;&quot;&gt;  81:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum82&quot; style=&quot;color: #606060;&quot;&gt;  82:&lt;/span&gt;         Assert.IsTrue(Actual);&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum83&quot; style=&quot;color: #606060;&quot;&gt;  83:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum84&quot; style=&quot;color: #606060;&quot;&gt;  84:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
for the full source see the sample application &lt;a href=&quot;http://bob-the-janitor-sample-code.googlecode.com/svn/trunk/SampleApplication/&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.</description><link>http://bob-the-janitor.blogspot.com/2012/06/testing-for-execution-sequence.html</link><author>noreply@blogger.com (Bob The Janitor)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-4910153503464973344</guid><pubDate>Wed, 20 Jun 2012 06:57:00 +0000</pubDate><atom:updated>2012-06-20T00:57:20.047-06:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">TDD</category><title>Behavioral testing with NUnit</title><description>The traditional unit test works great for testing code functionality but another important testing aspect is testing code’s behavior and you don’t need to use a behavior testing framework like mspec to do it, with the right pattern nunit, mstest, and xunit work just fine.&lt;br /&gt;
A traditional TestFixture might look something like this&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-style: none; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; [TestFixture]&lt;/pre&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060; font-size: 8pt; line-height: 12pt;&quot;&gt;&amp;nbsp; &amp;nbsp;2:&lt;/span&gt;&lt;span style=&quot;font-size: 8pt; line-height: 12pt;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue; font-size: 8pt; line-height: 12pt;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;font-size: 8pt; line-height: 12pt;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue; font-size: 8pt; line-height: 12pt;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;font-size: 8pt; line-height: 12pt;&quot;&gt; EmployeeRequests_Tests&lt;/span&gt;&lt;/div&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   4:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;private&lt;/span&gt; EmployeeRequests target;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   5:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;private&lt;/span&gt; Mock&amp;lt;IEmployeeRepository&amp;gt; MockEmployeeRepository;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060;&quot;&gt;   6:&lt;/span&gt;     [SetUp]&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum7&quot; style=&quot;color: #606060;&quot;&gt;   7:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Setup()&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum8&quot; style=&quot;color: #606060;&quot;&gt;   8:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum9&quot; style=&quot;color: #606060;&quot;&gt;   9:&lt;/span&gt;         target = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; EmployeeRequests();&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum10&quot; style=&quot;color: #606060;&quot;&gt;  10:&lt;/span&gt;         MockEmployeeRepository = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; Mock&amp;lt;IEmployeeRepository&amp;gt;();&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum11&quot; style=&quot;color: #606060;&quot;&gt;  11:&lt;/span&gt;         MockEmployeeRepository.Setup(x =&amp;gt; &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum12&quot; style=&quot;color: #606060;&quot;&gt;  12:&lt;/span&gt;             x.GetEmployeeByCityState(It.IsAny&amp;lt;&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;&amp;gt;(), It.IsAny&amp;lt;&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;&amp;gt;()))&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum13&quot; style=&quot;color: #606060;&quot;&gt;  13:&lt;/span&gt;             .Returns(&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; List&amp;lt;EmployeeDvr&amp;gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum14&quot; style=&quot;color: #606060;&quot;&gt;  14:&lt;/span&gt;                {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum15&quot; style=&quot;color: #606060;&quot;&gt;  15:&lt;/span&gt;                    &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; EmployeeDvr {City = &lt;span style=&quot;color: #006080;&quot;&gt;&quot;Seattle&quot;&lt;/span&gt;, State = &lt;span style=&quot;color: #006080;&quot;&gt;&quot;Washington&quot;&lt;/span&gt;, EmployeeName = &lt;span style=&quot;color: #006080;&quot;&gt;&quot;bob&quot;&lt;/span&gt;}&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum16&quot; style=&quot;color: #606060;&quot;&gt;  16:&lt;/span&gt;                });&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum17&quot; style=&quot;color: #606060;&quot;&gt;  17:&lt;/span&gt;         target.EmployeeRepository = MockEmployeeRepository.Object;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum18&quot; style=&quot;color: #606060;&quot;&gt;  18:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum19&quot; style=&quot;color: #606060;&quot;&gt;  19:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum20&quot; style=&quot;color: #606060;&quot;&gt;  20:&lt;/span&gt;     [Test]&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum21&quot; style=&quot;color: #606060;&quot;&gt;  21:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; ReturnsErrorForEmptyCity_Test()&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum22&quot; style=&quot;color: #606060;&quot;&gt;  22:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum23&quot; style=&quot;color: #606060;&quot;&gt;  23:&lt;/span&gt;         target.GetEmployeeByLocation(&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;.Empty, &lt;span style=&quot;color: #006080;&quot;&gt;&quot;Washington&quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum24&quot; style=&quot;color: #606060;&quot;&gt;  24:&lt;/span&gt;         var actual = target.Errors.Where(x =&amp;gt; x.Contains(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Invalid City&quot;&lt;/span&gt;));&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum25&quot; style=&quot;color: #606060;&quot;&gt;  25:&lt;/span&gt;         Assert.AreEqual(1,actual.Count());&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum26&quot; style=&quot;color: #606060;&quot;&gt;  26:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum27&quot; style=&quot;color: #606060;&quot;&gt;  27:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum28&quot; style=&quot;color: #606060;&quot;&gt;  28:&lt;/span&gt;     [Test]&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum29&quot; style=&quot;color: #606060;&quot;&gt;  29:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; ReturnsErrorForEmptyState_Test()&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum30&quot; style=&quot;color: #606060;&quot;&gt;  30:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum31&quot; style=&quot;color: #606060;&quot;&gt;  31:&lt;/span&gt;         target.GetEmployeeByLocation(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Seattle&quot;&lt;/span&gt;, &lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;.Empty);&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum32&quot; style=&quot;color: #606060;&quot;&gt;  32:&lt;/span&gt;         var actual = target.Errors.Where(x =&amp;gt; x.Contains(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Invalid State&quot;&lt;/span&gt;));&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum33&quot; style=&quot;color: #606060;&quot;&gt;  33:&lt;/span&gt;         Assert.AreEqual(1, actual.Count());&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum34&quot; style=&quot;color: #606060;&quot;&gt;  34:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum35&quot; style=&quot;color: #606060;&quot;&gt;  35:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum36&quot; style=&quot;color: #606060;&quot;&gt;  36:&lt;/span&gt;     [Test]&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum37&quot; style=&quot;color: #606060;&quot;&gt;  37:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; VailidCityStateCallRepository_Test()&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum38&quot; style=&quot;color: #606060;&quot;&gt;  38:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum39&quot; style=&quot;color: #606060;&quot;&gt;  39:&lt;/span&gt;         target.GetEmployeeByLocation(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Seattle&quot;&lt;/span&gt;, &lt;span style=&quot;color: #006080;&quot;&gt;&quot;Washington&quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum40&quot; style=&quot;color: #606060;&quot;&gt;  40:&lt;/span&gt;         MockEmployeeRepository.Verify(x =&amp;gt; x.GetEmployeeByCityState(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Seattle&quot;&lt;/span&gt;, &lt;span style=&quot;color: #006080;&quot;&gt;&quot;Washington&quot;&lt;/span&gt;));&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum41&quot; style=&quot;color: #606060;&quot;&gt;  41:&lt;/span&gt;     }     &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum42&quot; style=&quot;color: #606060;&quot;&gt;  42:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
Having a fairly large TestFixture with a lot of tests for the different functions of the method being called.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
When doing behavior testing the idea is to test a code path for a specific context vs. testing for all possibilities a method could result in, basically breaking it down into much easier to read parts.&lt;br /&gt;
&lt;br /&gt;
To do this we set up a base or abstract class that has a context method for setting up your test and a because method for running it, here is an example of one using generics&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; [TestFixture]&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060;&quot;&gt;   2:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;abstract&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt; Test_Context&amp;lt;T&amp;gt; &lt;span style=&quot;color: blue;&quot;&gt;where&lt;/span&gt; T : &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;() &lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   4:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; T Target;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   5:&lt;/span&gt;     &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060;&quot;&gt;   6:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum7&quot; style=&quot;color: #606060;&quot;&gt;   7:&lt;/span&gt;     [SetUp]&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum8&quot; style=&quot;color: #606060;&quot;&gt;   8:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Setup()&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum9&quot; style=&quot;color: #606060;&quot;&gt;   9:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum10&quot; style=&quot;color: #606060;&quot;&gt;  10:&lt;/span&gt;         Context();&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum11&quot; style=&quot;color: #606060;&quot;&gt;  11:&lt;/span&gt;         Because();&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum12&quot; style=&quot;color: #606060;&quot;&gt;  12:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum13&quot; style=&quot;color: #606060;&quot;&gt;  13:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum14&quot; style=&quot;color: #606060;&quot;&gt;  14:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;virtual&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Context()&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum15&quot; style=&quot;color: #606060;&quot;&gt;  15:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum16&quot; style=&quot;color: #606060;&quot;&gt;  16:&lt;/span&gt;         Target = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; T();&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum17&quot; style=&quot;color: #606060;&quot;&gt;  17:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum18&quot; style=&quot;color: #606060;&quot;&gt;  18:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum19&quot; style=&quot;color: #606060;&quot;&gt;  19:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;abstract&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Because();&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum20&quot; style=&quot;color: #606060;&quot;&gt;  20:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
next we set up the the test fixture&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; [TestFixture]&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060;&quot;&gt;   2:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt; When_Requesting_Employees_From_Seattle_Washington_Tests : Test_Context&amp;lt;EmployeeRequests&amp;gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   4:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; Mock&amp;lt;IEmployeeRepository&amp;gt; MockEmployeeRepository;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   5:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060;&quot;&gt;   6:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;override&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Context()&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum7&quot; style=&quot;color: #606060;&quot;&gt;   7:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum8&quot; style=&quot;color: #606060;&quot;&gt;   8:&lt;/span&gt;         &lt;span style=&quot;color: blue;&quot;&gt;base&lt;/span&gt;.Context();&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum9&quot; style=&quot;color: #606060;&quot;&gt;   9:&lt;/span&gt;         MockEmployeeRepository = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; Mock&amp;lt;IEmployeeRepository&amp;gt;();&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum10&quot; style=&quot;color: #606060;&quot;&gt;  10:&lt;/span&gt;         MockEmployeeRepository.Setup(x =&amp;gt; x.GetEmployeeByCityState(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Seattle&quot;&lt;/span&gt;, &lt;span style=&quot;color: #006080;&quot;&gt;&quot;Washington&quot;&lt;/span&gt;))&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum11&quot; style=&quot;color: #606060;&quot;&gt;  11:&lt;/span&gt;             .Returns(&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; List&amp;lt;EmployeeDvr&amp;gt; { &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; EmployeeDvr { City = &lt;span style=&quot;color: #006080;&quot;&gt;&quot;Seattle&quot;&lt;/span&gt;, State = &lt;span style=&quot;color: #006080;&quot;&gt;&quot;Washington&quot;&lt;/span&gt; } });&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum12&quot; style=&quot;color: #606060;&quot;&gt;  12:&lt;/span&gt;         Target.EmployeeRepository = MockEmployeeRepository.Object;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum13&quot; style=&quot;color: #606060;&quot;&gt;  13:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum14&quot; style=&quot;color: #606060;&quot;&gt;  14:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum15&quot; style=&quot;color: #606060;&quot;&gt;  15:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;override&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Because()&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum16&quot; style=&quot;color: #606060;&quot;&gt;  16:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum17&quot; style=&quot;color: #606060;&quot;&gt;  17:&lt;/span&gt;         Target.GetEmployeeByLocation(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Seattle&quot;&lt;/span&gt;, &lt;span style=&quot;color: #006080;&quot;&gt;&quot;Washington&quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum18&quot; style=&quot;color: #606060;&quot;&gt;  18:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum19&quot; style=&quot;color: #606060;&quot;&gt;  19:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum20&quot; style=&quot;color: #606060;&quot;&gt;  20:&lt;/span&gt;     [Test]&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum21&quot; style=&quot;color: #606060;&quot;&gt;  21:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; HasNoErrors_Test()&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum22&quot; style=&quot;color: #606060;&quot;&gt;  22:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum23&quot; style=&quot;color: #606060;&quot;&gt;  23:&lt;/span&gt;         Assert.AreEqual(0,Target.Errors.Count);&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum24&quot; style=&quot;color: #606060;&quot;&gt;  24:&lt;/span&gt;     }   &lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum25&quot; style=&quot;color: #606060;&quot;&gt;  25:&lt;/span&gt;  &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum26&quot; style=&quot;color: #606060;&quot;&gt;  26:&lt;/span&gt;     [Test]&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum27&quot; style=&quot;color: #606060;&quot;&gt;  27:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Calls_The_Repository()&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum28&quot; style=&quot;color: #606060;&quot;&gt;  28:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum29&quot; style=&quot;color: #606060;&quot;&gt;  29:&lt;/span&gt;         MockEmployeeRepository.Verify(x=&amp;gt;x.GetEmployeeByCityState(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Seattle&quot;&lt;/span&gt;,&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Washington&quot;&lt;/span&gt;),Times.Once());&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum30&quot; style=&quot;color: #606060;&quot;&gt;  30:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum31&quot; style=&quot;color: #606060;&quot;&gt;  31:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
a couple of things you may notice is first the the name is fairly long and descriptive, the idea is you want to make it easy to read the test results to know what your testing, in this case requesting employees from Seattle, WA.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
The next thing you may notice is we don’t have as many test methods, sense we are only testing for what happens when we are getting employees from Seattle, WA. that’s all we are testing for.&amp;nbsp; This may produce more test textures classes but at the same the test fixtures are more targeted and give a better description of what you are testing making it easier to read/maintain later and is sometimes called executable specifications, where you can find out the intended function of a class or method simply by reading then names for the test fixture and tests.&amp;nbsp; For more examples of unit tests vs. behavoir tests&amp;nbsp; see the &lt;a href=&quot;http://bob-the-janitor-sample-code.googlecode.com/svn/trunk/SampleApplication/&quot; target=&quot;_blank&quot;&gt;sample application&lt;/a&gt; in the sample code repository.</description><link>http://bob-the-janitor.blogspot.com/2012/06/behavioral-testing-with-nunit.html</link><author>noreply@blogger.com (Bob The Janitor)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-8807360932679098592</guid><pubDate>Mon, 30 Apr 2012 03:56:00 +0000</pubDate><atom:updated>2012-04-29T22:13:58.929-06:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">C#</category><title>Using description attribute class with enums</title><description>Enums are very useful way to make constant strongly typed replacements for magic numbers/string that are also self-documenting, the down side is they can be a little limiting, to solve this we can use class attributes and extension methods to get more out of them.&lt;br /&gt;
&lt;br /&gt;
Adding a description to a Enum is fairly easy just use the System.ComponentModel.DescriptionAttribute class to add descriptions to the enum values&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;enum&lt;/span&gt; BuildingTypes&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060;&quot;&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt;     [Description(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Retail Space&quot;&lt;/span&gt;)]&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   4:&lt;/span&gt;     RetailSpace=1,&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   5:&lt;/span&gt;     [Description(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Office Space&quot;&lt;/span&gt;)]&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060;&quot;&gt;   6:&lt;/span&gt;     OfficeSpace=2,&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum7&quot; style=&quot;color: #606060;&quot;&gt;   7:&lt;/span&gt;     [Description(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Single Family Residence&quot;&lt;/span&gt;)]&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum8&quot; style=&quot;color: #606060;&quot;&gt;   8:&lt;/span&gt;     SingleFamilyResidence=3,&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum9&quot; style=&quot;color: #606060;&quot;&gt;   9:&lt;/span&gt;     [Description(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Multi Family Residence&quot;&lt;/span&gt;)]&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum10&quot; style=&quot;color: #606060;&quot;&gt;  10:&lt;/span&gt;     MultiFamilyResidence=4,&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum11&quot; style=&quot;color: #606060;&quot;&gt;  11:&lt;/span&gt;     [Description(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Warehouse&quot;&lt;/span&gt;)]&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum12&quot; style=&quot;color: #606060;&quot;&gt;  12:&lt;/span&gt;     Warehouse =5,&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum13&quot; style=&quot;color: #606060;&quot;&gt;  13:&lt;/span&gt;     [Description(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Manufacturing&quot;&lt;/span&gt;)]&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum14&quot; style=&quot;color: #606060;&quot;&gt;  14:&lt;/span&gt;     Manufacturing =6&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum15&quot; style=&quot;color: #606060;&quot;&gt;  15:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
In order to get the descriptions from the enum we need to do a little reflection and wrap it up in an extension method&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; ToDiscription(&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt; Enum &lt;span style=&quot;color: blue;&quot;&gt;value&lt;/span&gt;)&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060;&quot;&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt;     var description = &lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;.Empty;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   4:&lt;/span&gt;     FieldInfo fi = &lt;span style=&quot;color: blue;&quot;&gt;value&lt;/span&gt;.GetType().GetField(&lt;span style=&quot;color: blue;&quot;&gt;value&lt;/span&gt;.ToString());&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   5:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060;&quot;&gt;   6:&lt;/span&gt;     var attributes = (DescriptionAttribute[])fi.GetCustomAttributes(&lt;span style=&quot;color: blue;&quot;&gt;typeof&lt;/span&gt;(DescriptionAttribute),&lt;span style=&quot;color: blue;&quot;&gt;false&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum7&quot; style=&quot;color: #606060;&quot;&gt;   7:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum8&quot; style=&quot;color: #606060;&quot;&gt;   8:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (attributes != &lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt; &amp;amp;&amp;amp; attributes.Length &amp;gt; 0)&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum9&quot; style=&quot;color: #606060;&quot;&gt;   9:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum10&quot; style=&quot;color: #606060;&quot;&gt;  10:&lt;/span&gt;         description = attributes[0].Description;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum11&quot; style=&quot;color: #606060;&quot;&gt;  11:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum12&quot; style=&quot;color: #606060;&quot;&gt;  12:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;else&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum13&quot; style=&quot;color: #606060;&quot;&gt;  13:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum14&quot; style=&quot;color: #606060;&quot;&gt;  14:&lt;/span&gt;         description = &lt;span style=&quot;color: blue;&quot;&gt;value&lt;/span&gt;.ToString();&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum15&quot; style=&quot;color: #606060;&quot;&gt;  15:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum16&quot; style=&quot;color: #606060;&quot;&gt;  16:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; description;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum17&quot; style=&quot;color: #606060;&quot;&gt;  17:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
Simple as that, for the full source see my &lt;a href=&quot;http://bob-the-janitor-sample-code.googlecode.com/svn/trunk/SampleApplication/SampleApplication.Objects/&quot; target=&quot;_blank&quot;&gt;sample code repository&lt;/a&gt;</description><link>http://bob-the-janitor.blogspot.com/2012/04/using-description-class-attributes-with.html</link><author>noreply@blogger.com (Bob The Janitor)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-8681043893240929497</guid><pubDate>Mon, 26 Mar 2012 19:29:00 +0000</pubDate><atom:updated>2012-03-26T13:29:16.257-06:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">MVC</category><title>Creating Custom Asp.net MVC ViewEngine</title><description>In the last post I talked about creating a custom ActionResult, the next question is, what if I want to add my a custom view engine?&amp;nbsp;&amp;nbsp; As an example lets say your company’s intranet uses multiple platforms (php, java, and now asp.net mvc) and to keep the look and feel constant you use xslt to render your header and footer, a simple solution is to add a xslt View Engine to generate the markup.&lt;br /&gt;
&lt;br /&gt;
First you create a view to parse and output for content&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt; XsltView : IView&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060;&quot;&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;readonly&lt;/span&gt; XslCompiledTransform _template;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   4:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   5:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; XsltView(ControllerContext controllerContext, &lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; viewPath)&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060;&quot;&gt;   6:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum7&quot; style=&quot;color: #606060;&quot;&gt;   7:&lt;/span&gt;         _template = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; XslCompiledTransform();&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum8&quot; style=&quot;color: #606060;&quot;&gt;   8:&lt;/span&gt;         _template.Load(controllerContext.HttpContext.Server.MapPath(viewPath));&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum9&quot; style=&quot;color: #606060;&quot;&gt;   9:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum10&quot; style=&quot;color: #606060;&quot;&gt;  10:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum11&quot; style=&quot;color: #606060;&quot;&gt;  11:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Render(ViewContext viewContext, TextWriter writer)&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum12&quot; style=&quot;color: #606060;&quot;&gt;  12:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum13&quot; style=&quot;color: #606060;&quot;&gt;  13:&lt;/span&gt;         var xmlDoc = viewContext.ViewData.Model &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; XDocument;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum14&quot; style=&quot;color: #606060;&quot;&gt;  14:&lt;/span&gt;         &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;(xmlDoc==&lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum15&quot; style=&quot;color: #606060;&quot;&gt;  15:&lt;/span&gt;         {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum16&quot; style=&quot;color: #606060;&quot;&gt;  16:&lt;/span&gt;             var xs = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; XmlSerializer(viewContext.ViewData.Model.GetType());&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum17&quot; style=&quot;color: #606060;&quot;&gt;  17:&lt;/span&gt;             xmlDoc = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; XDocument();&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum18&quot; style=&quot;color: #606060;&quot;&gt;  18:&lt;/span&gt;             &lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt; (var xWriter = xmlDoc.CreateWriter())&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum19&quot; style=&quot;color: #606060;&quot;&gt;  19:&lt;/span&gt;             {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum20&quot; style=&quot;color: #606060;&quot;&gt;  20:&lt;/span&gt;                 xs.Serialize(xWriter, viewContext.ViewData.Model);&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum21&quot; style=&quot;color: #606060;&quot;&gt;  21:&lt;/span&gt;             }&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum22&quot; style=&quot;color: #606060;&quot;&gt;  22:&lt;/span&gt;         }&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum23&quot; style=&quot;color: #606060;&quot;&gt;  23:&lt;/span&gt;         _template.Transform(xmlDoc.CreateReader(),&lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;,writer);&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum24&quot; style=&quot;color: #606060;&quot;&gt;  24:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum25&quot; style=&quot;color: #606060;&quot;&gt;  25:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
then you create a view engine by inheriting from VirtualPathProviderViewEngine and override the CreatePartialView and CreateView methods to call your view&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt; XsltViewEngine : VirtualPathProviderViewEngine&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060;&quot;&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;protected&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;override&lt;/span&gt; IView CreatePartialView(ControllerContext controllerContext, &lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; partialPath)&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   4:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   5:&lt;/span&gt;         &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; XsltView(controllerContext, partialPath);&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060;&quot;&gt;   6:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum7&quot; style=&quot;color: #606060;&quot;&gt;   7:&lt;/span&gt;  &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum8&quot; style=&quot;color: #606060;&quot;&gt;   8:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;protected&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;override&lt;/span&gt; IView CreateView(ControllerContext controllerContext, &lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; viewPath, &lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; masterPath)&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum9&quot; style=&quot;color: #606060;&quot;&gt;   9:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum10&quot; style=&quot;color: #606060;&quot;&gt;  10:&lt;/span&gt;         &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; XsltView(controllerContext, viewPath);&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum11&quot; style=&quot;color: #606060;&quot;&gt;  11:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum12&quot; style=&quot;color: #606060;&quot;&gt;  12:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
to add the view open global.ascx.cs and modify the application start method to add the new view engine&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;protected&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Application_Start()&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060;&quot;&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt;     AreaRegistration.RegisterAllAreas();&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   4:&lt;/span&gt;     ViewEngines.Engines.Clear();&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   5:&lt;/span&gt;     ViewEngines.Engines.Add(&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; WebFormViewEngine());&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060;&quot;&gt;   6:&lt;/span&gt;     ViewEngines.Engines.Add(&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; RazorViewEngine());&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum7&quot; style=&quot;color: #606060;&quot;&gt;   7:&lt;/span&gt;     ViewEngines.Engines.Add(&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; XsltViewEngine&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum8&quot; style=&quot;color: #606060;&quot;&gt;   8:&lt;/span&gt;         {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum9&quot; style=&quot;color: #606060;&quot;&gt;   9:&lt;/span&gt;             ViewLocationFormats = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; [] { &lt;span style=&quot;color: #006080;&quot;&gt;&quot;~/Views/{1}/{0}.xslt&quot;&lt;/span&gt;, &lt;span style=&quot;color: #006080;&quot;&gt;&quot;~/Views/Shared/{0}.xslt&quot;&lt;/span&gt; },&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum10&quot; style=&quot;color: #606060;&quot;&gt;  10:&lt;/span&gt;             PartialViewLocationFormats = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;[] { &lt;span style=&quot;color: #006080;&quot;&gt;&quot;~/Views/{1}/{0}.xslt&quot;&lt;/span&gt;, &lt;span style=&quot;color: #006080;&quot;&gt;&quot;~/Views/Shared/{0}.xslt&quot;&lt;/span&gt; }&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum11&quot; style=&quot;color: #606060;&quot;&gt;  11:&lt;/span&gt;         });&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum12&quot; style=&quot;color: #606060;&quot;&gt;  12:&lt;/span&gt;     RegisterGlobalFilters(GlobalFilters.Filters);&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum13&quot; style=&quot;color: #606060;&quot;&gt;  13:&lt;/span&gt;     RegisterRoutes(RouteTable.Routes);&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum14&quot; style=&quot;color: #606060;&quot;&gt;  14:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
now to use it just add you xslt file to your view folder like you would with any other view and return your serializable object to the the View you’re returning&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; ActionResult TransformedView()&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060;&quot;&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt;     var model = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; BasicDemoModel{Name = &lt;span style=&quot;color: #006080;&quot;&gt;&quot;Demo User&quot;&lt;/span&gt;};&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   4:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; View(model);&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   5:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
for the full source (&lt;a href=&quot;http://bob-the-janitor-sample-code.googlecode.com/svn/trunk/SampleApplication/&quot; target=&quot;_blank&quot;&gt;click here&lt;/a&gt;)</description><link>http://bob-the-janitor.blogspot.com/2012/03/creating-custom-aspnet-mvc-viewengine.html</link><author>noreply@blogger.com (Bob The Janitor)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-6664788809170526778</guid><pubDate>Sun, 25 Mar 2012 05:12:00 +0000</pubDate><atom:updated>2012-03-24T23:24:48.929-06:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><category domain="http://www.blogger.com/atom/ns#">MVC</category><title>Creating Custom Asp.net MVC ActionResults</title><description>One of the most powerful things in Asp.net MVC is how easy it is to extend, a really good example is ActionResults.&amp;nbsp; Basically all you have to do is inherit the ActionResult class and override the ExecuteResult method and add a constructor, with a few lines for code you can have an action return anything you want from dynamically generated pdf and xls files, to images.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
Here is an example of returning an object as xml  &lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt; XmlResult : ActionResult&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060;&quot;&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;readonly&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt; _item;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   4:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   5:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; XmlResult(&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt; item)&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060;&quot;&gt;   6:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum7&quot; style=&quot;color: #606060;&quot;&gt;   7:&lt;/span&gt;         _item = item;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum8&quot; style=&quot;color: #606060;&quot;&gt;   8:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum9&quot; style=&quot;color: #606060;&quot;&gt;   9:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum10&quot; style=&quot;color: #606060;&quot;&gt;  10:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;override&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; ExecuteResult(ControllerContext context)&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum11&quot; style=&quot;color: #606060;&quot;&gt;  11:&lt;/span&gt;     {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum12&quot; style=&quot;color: #606060;&quot;&gt;  12:&lt;/span&gt;         &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (_item != &lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum13&quot; style=&quot;color: #606060;&quot;&gt;  13:&lt;/span&gt;         {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum14&quot; style=&quot;color: #606060;&quot;&gt;  14:&lt;/span&gt;             var xs = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; XmlSerializer(_item.GetType());&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum15&quot; style=&quot;color: #606060;&quot;&gt;  15:&lt;/span&gt;             context.HttpContext.Response.ContentType = &lt;span style=&quot;color: #006080;&quot;&gt;&quot;text/xml&quot;&lt;/span&gt;;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum16&quot; style=&quot;color: #606060;&quot;&gt;  16:&lt;/span&gt;             xs.Serialize(context.HttpContext.Response.Output, _item);&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum17&quot; style=&quot;color: #606060;&quot;&gt;  17:&lt;/span&gt;         }&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum18&quot; style=&quot;color: #606060;&quot;&gt;  18:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum19&quot; style=&quot;color: #606060;&quot;&gt;  19:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;alt&quot;&gt;
basically you pass the object you want serialized into the constructor, and return it.&amp;nbsp; Inside the ExecuteResult method I do a quick null check, spin up a XmlSerializer set the response content type to “text/xml” and use the HttpContext.Response.Output to write the serialized data.&lt;br /&gt;  &lt;br /&gt;All you have to do to use it is create a new instance and return it from your action &lt;br /&gt;  &lt;/div&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; ActionResult Index()&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060;&quot;&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt;     var model = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; BasicDemoModel();&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   4:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; XmlResult(model);&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   5:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;To see the code used checkout the sample application at &lt;a href=&quot;http://bob-the-janitor-sample-code.googlecode.com/svn/trunk/SampleApplication/&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.</description><link>http://bob-the-janitor.blogspot.com/2012/03/creating-custom-aspnet-mvc.html</link><author>noreply@blogger.com (Bob The Janitor)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-1636228500647595309</guid><pubDate>Thu, 19 Jan 2012 19:50:00 +0000</pubDate><atom:updated>2012-01-19T12:50:45.123-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Best Practices</category><category domain="http://www.blogger.com/atom/ns#">Continues Integration</category><category domain="http://www.blogger.com/atom/ns#">Tools</category><title>Automated Builds and Continuous Integration with Jenkins</title><description>&lt;p&gt;The concept of an automated build is fairly basic, you simply take your existing build file (make, nant, ant, msbuild(.sln), rake) and set up a service to build it from your source control repository.&amp;#160; &lt;/p&gt;  &lt;h4&gt;Automating builds &lt;/h4&gt;  &lt;p&gt;Setting up automated builds provide a number of advantages:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Everything your project needs to build and run is checked into source control. &lt;/li&gt;    &lt;li&gt;By scripting your builds you remove human error problems, computers are just better at running repetitive tasks &lt;/li&gt;    &lt;li&gt;Logging what was done and when it was done. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;At a former employer the marketing department needed to do content updates on a fairy regular basis; So they wouldn’t have to wait for us, I set them up with svn for the content directory and created some users for content deployment.&amp;#160; All they had to do was update the content and commit it and then deploy it.&amp;#160; We where happy because we didn’t need to spend time on their deployments, and they where happy because they could push content any time they wanted to. &lt;/p&gt;  &lt;h4&gt;Continuous Integration&amp;#160; &lt;/h4&gt;  &lt;p&gt;This is a key part of doing Test Driven Development, making sure your tests are run when checked in.&amp;#160; This makes sure that all of the tests are working in the build environment, and lets everyone know when there is a problem as soon as the build runs, and lets the developer responsible to fix it as soon as possible, creating an over all better code quality.&amp;#160; &lt;/p&gt;  &lt;h4&gt;Using Jenkins&lt;/h4&gt;  &lt;p&gt;Jenkins is an open source Build server forked from the Hudson project, basically when Oracle bought Sun/Java some of the Hudson team decided to was time to go their own way.&amp;#160; Jenkins Benefits from a log history of community support from it’s Hudson days allowing it to be a very mature and extendable system.&amp;#160; Having said that, it not as easy to use as some other build servers (see &lt;a href=&quot;http://bob-the-janitor.blogspot.com/2009/04/continues-integration-with-team-city.html&quot;&gt;Continues Integration with TeamCity&lt;/a&gt;) but what it lacks in ease of use, it makes up for in versatility and flexibility.&lt;/p&gt;  &lt;h5&gt;User Management&lt;/h5&gt;  &lt;p&gt;Like most things in Jenkins User management is very flexible by default supporting LDAP, it’s own internal user DB, delegate to servlet container, and has a huge list of user management plug-ins for everything from Active Directory to GitHub OAuth.&amp;#160; Once the user is added you also have a fairly flexible authorization set up&amp;#160; from allowing anyone to do anything to completely locking it down.&amp;#160; &lt;/p&gt;  &lt;p&gt;My biggest complaint here is that by default everything is wide open and the responsibility of locking everything down is placed on the administrator.&lt;/p&gt;  &lt;h5&gt;Build Jobs&lt;/h5&gt;  &lt;p&gt;By default Jenkins supports Maven2/3, completely rolling your own multi part build, and Monitoring an external job but&amp;#160; with a large selection of plug-ins supporting everything from rake to powershell to Fitness, to an Android Emulator.&lt;/p&gt;  &lt;p&gt;Rolling your own multi part build is fairly strait forward if a little involved with a lot of the basic options you would expect like wither to keep old builds, how long do you want to keep them, how many do you keep, Quiet period, retry count, etc.&lt;/p&gt;  &lt;p&gt;With it’s plug-ins your source control provider options are just about anything you can think of including:SVN, CSV, Git, ClearCase, etc. The same for build triggers by default it supports build after other projects, build periodically(nightly builds for example), pull scm, and remote triggering(call a url with an auth token to start a build).&lt;/p&gt;  &lt;p&gt;When your done with your build you have built in support to ftp or ssh your build results with plug-ins to do everything from upload to &lt;a href=&quot;http://aws.amazon.com/s3/&quot;&gt;Amazon S3&lt;/a&gt; to the &lt;a href=&quot;http://www.appaloosa-store.com/&quot;&gt;Appaloose Store&lt;/a&gt; for mobile apps.&lt;/p&gt;  &lt;p&gt;The down side to all of this flexibility is you are forced to do a lot for the configuration your self, unlike &lt;a href=&quot;http://www.jetbrains.com/teamcity/&quot;&gt;TeamCity&lt;/a&gt;, if you want your code test results published you have to configure it yourself, if you want your code coverage results, you have to configure it to use something like &lt;a href=&quot;http://sourceforge.net/projects/partcover/&quot;&gt;PartCover&lt;/a&gt; yourself. &lt;/p&gt;  &lt;h5&gt;Reporting&lt;/h5&gt;  &lt;p&gt;Just as important as automating your builds is knowing what is going on with them, when are they running, did it fail, what failed, etc.&amp;#160; Jenkins has fairly nice tools built in to show you what is going on.&amp;#160; With a build history trend report, rss feeds, Email notification, and plug-ins to support everything from dashboard views to creating a Wall friendly display of all build jobs.&lt;/p&gt;  &lt;h4&gt;Conclusion &lt;/h4&gt;  &lt;p&gt;While not as nice to set up and manage as some other build servers, Jenkins is incredibly powerful with a lot of flexibly, and to be honest it’s really hard to complain about an enterprise level build server for free.&amp;#160; I would make the comparison between running Linux VS. Windows servers, Windows may be more polished but it’s not as flexible.&lt;/p&gt;  </description><link>http://bob-the-janitor.blogspot.com/2012/01/automated-builds-and-continuous.html</link><author>noreply@blogger.com (Bob The Janitor)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-1332094654226316679</guid><pubDate>Mon, 09 Jan 2012 05:28:00 +0000</pubDate><atom:updated>2012-01-08T22:34:12.832-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Development</category><category domain="http://www.blogger.com/atom/ns#">Tools</category><title>Finally decided to do a dev tools list</title><description>One of the most important parts of being a craftsman is your selection of tools, it doesn’t matter if you are a carpenter, a mason, cabinet maker, or even a software developer, your tools allow you to get the work done.&amp;nbsp;&amp;nbsp; What tools you use really depends on your style and technique and may very greatly depending on the person.&amp;nbsp; This is a simple list of IDEs, editors, libraries, etc. that I like and work for me, some are pay for, most are not.&amp;nbsp; This isn&#39;t a complete list of the tools I use but it&#39;s a good solid overview of what I use on a day to day basis, take a look and see what you like, or don’t.&lt;br /&gt;
&lt;h4&gt;
IDEs&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.microsoft.com/visualstudio/en-us&quot; target=&quot;_blank&quot;&gt;Visual Studio 2010&lt;/a&gt; – The default editor for doing .NET development, it has it’s share of problems but for the most part it a very sold IDE. &lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://monodevelop.com/&quot; target=&quot;_blank&quot;&gt;MonoDevelop&lt;/a&gt; – This is where .NET started for me 8 years ago, not a lot of frills, but for a fully functional cross platform IDE for .NET the price is right at free, unless you want to do Android or IOS, then you need to buy monoDroid or monoTouch. &lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://netbeans.org/&quot; target=&quot;_blank&quot;&gt;NetBeans&lt;/a&gt; – My go to java and PHP IDE, with good intellisense and built in refactoring tools.&amp;nbsp; &lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
Visual Studio Plugins&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.jetbrains.com/resharper/&quot; target=&quot;_blank&quot;&gt;Resharper&lt;/a&gt; – The most valuable IDE plugin I have ever used, providing nUnit support, refactoring, add reference, and the list keeps going.&amp;nbsp; I honestly have a hard time using Visual Studio with out it. &lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.jetbrains.com/dotcover/&quot; target=&quot;_blank&quot;&gt;DotCover&lt;/a&gt; – An important part of test driven development is code coverage, and DotCover is my coverage tool of choice.&amp;nbsp; It integrates with Resharper’s test runner to provide on request code coverage in the IDE. &lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
Source Control&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://ankhsvn.open.collab.net/&quot; target=&quot;_blank&quot;&gt;AnkhSVN&lt;/a&gt; – Provides SVN support for Visual Studio, so far this is the best free SVN plugin I have found for Visual Studio &lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.visualsvn.com/server/&quot; target=&quot;_blank&quot;&gt;Visual SVN server&lt;/a&gt; – A simple and easy SVN server that just works, it may not have a lot of bells and whistles but it’s easy to install and manage users. &lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
Text Editors&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://notepad-plus-plus.org/&quot; target=&quot;_blank&quot;&gt;Notepad++&lt;/a&gt; – One of the first things I do on any new windows system is install Notepad++, it integrates with Windows explorer making it simple to edit any text file with out having to deal with what the default app is for the ext. with a huge list of plugins for everything from XML to powershell it is the Swiss Army Knife of text editors. &lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
SQL Tools&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://toadforsqlserver.com/index.jspa&quot; target=&quot;_blank&quot;&gt;Toad For SQL Server&lt;/a&gt; – This is a new item on my tools list, I just started using it this week, but I really like it.&amp;nbsp; The community version has some really nice intellisense, and the way the UI works is just clean.&amp;nbsp; I’m really interested in seeing a head to head comparison between Redgate’s SQL Tool belt and Toad Development Suite for SqlServer, the features look about the same, but at around $1,300 vs. $2,000 toad is a lot cheaper. &lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/schambers/fluentmigrator&quot; target=&quot;_blank&quot;&gt;FluentMigriator&lt;/a&gt; – A .NET version of the Ruby Migrations tool.&amp;nbsp; With a fairly simple syntax and helpers it makes scripting DB changes easy, to read more check out this blog post I did a little while ago, &lt;a href=&quot;http://bob-the-janitor.blogspot.com/2011/07/using-fluentmigrator-with-nant.html&quot; target=&quot;_blank&quot;&gt;Using Fluentmigrator with nant&lt;/a&gt;. &lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
Unit Testing&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.nunit.org/&quot; target=&quot;_blank&quot;&gt;NUnit&lt;/a&gt; – The work horse of the .NET unit testing world.&amp;nbsp; It’s a solid testing framework with some of the best tool support out there, with the exception if Visual Studio, but Resharper fixes that.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://code.google.com/p/moq/&quot; target=&quot;_blank&quot;&gt;Moq&lt;/a&gt; – The Simplest mocking framework for .NET.&amp;nbsp; With a clean fluent syntax that provides ease of use and versatility.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
Build And CI Server&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.jetbrains.com/teamcity/&quot; target=&quot;_blank&quot;&gt;Team City&lt;/a&gt; – By far the easiest to get set up and start running with.&amp;nbsp; With built in support for most of the tools I use and has DotCover built in, it provides a solid solution out of the box with a very polished UX.&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://jenkins-ci.org/&quot; target=&quot;_blank&quot;&gt;Jenkins&lt;/a&gt; – A fork of the Hudson project, Jenkins is a solid if less then polished build and CI server solution, but what it lacks in polish it makes up in versatility and flexibility, with a huge selection of plugins for integrating into just about development environment and deploying to just about any other system out there.&lt;/li&gt;
&lt;/ul&gt;</description><link>http://bob-the-janitor.blogspot.com/2012/01/finally-decided-to-do-dev-tools-list.html</link><author>noreply@blogger.com (Bob The Janitor)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-4637900175115166116</guid><pubDate>Thu, 05 Jan 2012 21:09:00 +0000</pubDate><atom:updated>2013-04-29T12:03:25.708-06:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Best Practices</category><category domain="http://www.blogger.com/atom/ns#">TDD</category><title>Test Driven Development for the management point of view</title><description>&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
When I have given presentations on TDD, one of the biggest questions
I get is “How do I sell this to my boss?”, and it’s a very valid question, you
are basically asking your boss to let you write 2-3x as much code to make sure
the code you wrote is correct, that’s a tough sell all on its own.&amp;nbsp; Software can never be done soon enough, most
projects are already behind from the start, and now you want to take more time
to write more code?&amp;nbsp; &lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoSubtitle&quot;&gt;
&lt;b&gt;Time is Money&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
There is a cost to Test Driven Development (TDD), you are
doing more work, writing tests takes time, maintaining tests takes time, and
running tests takes time.&amp;nbsp; With time equaling
money the question is “what are you buying?”, the simple answer is security,
and long term cost&amp;nbsp;reduction.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Ever wonder what it would be like to have a car without a
check engine light?&amp;nbsp; For the most part it’s
something most of us never look at.&amp;nbsp; When
it turns on we take it to the shop and the mechanic fixes whatever is wrong. &amp;nbsp;Without the check engine light to tell you something
is wrong, what could have been a small repair is now an engine rebuild.&amp;nbsp; Having tests provides you with the same thing,
it lets you know there is a problem before it becomes a larger problem, this
could be inconsistent application behavior, data corruption, or the application
crashing.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: Calibri, sans-serif;&quot;&gt;Real world example&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span class=&quot;MsoSubtleEmphasis&quot;&gt;&lt;i&gt;At a former employer we were
migrating to a new production database for our flagship application, the database
it’s self was a very complex system, lots of tables, triggers, stored procedures,
etc. &amp;nbsp;&amp;nbsp;The DBA migrated the schema to the
new server, got a snapshot of the data and then ran our integration tests and
had failures everywhere, invalid permissions, missing columns, etc. &amp;nbsp;Even using the failed tests as a road map to
took the DBAs 1 ½ days to fix all of the problems.&amp;nbsp; I can’t even guess how long it would have
taken to fix if we would have just done to production, on top of that the
company’s main product would have been down, not only affecting us, but also
all of our customers that depended on our product to run their businesses. &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span class=&quot;MsoSubtleEmphasis&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
We Could have just blamed the DBA for not getting everything
right the first time, but at the same time, how much time was he given to do
it, would it have been cost effective to spend more time for this one time, verses
spending the time writing tests that can test it over and over again.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoSubtitle&quot;&gt;
&lt;b&gt;Spending a little to save a lot&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Software bugs have costs: they cost to find, they cost to
track, they cost to fix, they cost to verify when fixed, and they cost to push
out the fix.&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;text-indent: -0.25in;&quot;&gt;Cheap - A developer finds a bug when it was written,
he/she fixes it, very little cost&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;text-indent: -0.25in;&quot;&gt;More Expensive - QA finds the bug, the tester
needs to make sure it’s an actual bug, retest to verify how to reproduce it,
then records it a bug report, sends the bug report to the developer, the
developer fixes the bug, send the fix back to QA, it’s retested, then the bug
report is closed.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Symbol; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font: normal normal normal 7pt/normal &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;text-indent: -0.25in;&quot;&gt;Very Expensive – User finds bug, contacts
customer service, customer service sends bug to QA, QA verifies the bug,
creates a bug report, developer fixes bug, sends the fix to QA, QA verify bug
is fixed, bug fix is redeployed to production.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
How much the bug costs depends on how soon it’s discovered,
the sooner it’s discovered, the less people touch it and the less it costs.&amp;nbsp; By writing tests developers are far more
likely to find bugs sooner also nothing is more frustrating than having bugs reappear,
manually retesting existing functionality takes time, and increases QA cost,
also reduces the time QA has to find new bugs, and edge case bugs.&amp;nbsp; TDD inherently provides regression testing
and can greatly reduce your QA time. &amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: Calibri, sans-serif;&quot;&gt;Real world example&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span class=&quot;MsoSubtleEmphasis&quot;&gt;&lt;i&gt;At one time I worked as a QA Engineer
at a major printer company, a little over half my time was spent not only
testing new functionality, but existing functionality as well, the rest of my
time was spent sending bug reports to the developers, having the developers
asking for clarification, verifying the bug was fixed, etc. &amp;nbsp;&amp;nbsp;&amp;nbsp;As
much as it cost for me to test a printer, the cost of having a driver or even
worse a firmware bug get released to the customer where astronomical.&amp;nbsp; By reducing the time I had to spend retesting
and verifying bugs, I could spend more time looking for edge case bugs.&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span class=&quot;MsoSubtleEmphasis&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Something else to think about is unlike web development where
you are only pushing code to your servers, having hardware in the hands of
consumers with a bug requires the added cost of service representatives, service techs,
etc.&amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoSubtitle&quot;&gt;
&lt;b&gt;Reducing Costs by building on a well build foundation&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
TDD by it nature encourages good development practices, by
breaking up chunks of code into more testable sections, you are turning them
into more manageable pieces; this reduces the amount of time and effort required
to update and maintain your application and greatly reducing the need for the
dreaded rewrite.&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Ask any construction contractor what makes the biggest difference
on a building remodel, and they are probably going to tell you “How well the original
building was built”.&amp;nbsp; If the foundation&amp;nbsp;isn&#39;t&amp;nbsp;level or the walls&amp;nbsp;aren&#39;t&amp;nbsp;straight, it’s going to make his job that much
harder having to compensate for the existing structure.&amp;nbsp; The same thing applies to software
development, the less old code that needs to change to add new features, the
less it costs to add new feature with the added bonus of the tests telling you
where your changes affect the rest of the application.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: Calibri, sans-serif;&quot;&gt;Real world example&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span class=&quot;MsoSubtleEmphasis&quot;&gt;&lt;i&gt;I wor&lt;span style=&quot;font-family: inherit;&quot;&gt;ked on a project that was
needed to replace how users authenticated; the user still entered a user name
and password, b&lt;/span&gt;ut how they were verified need to be updated for security reasons.&amp;nbsp; By having the application broken up, all that
needed to be changed is adding the new authentication code and changing one
line in the existing code to implement the new functionality.&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span class=&quot;MsoSubtleEmphasis&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: inherit; font-size: 11pt; line-height: 115%;&quot;&gt;Using
TDD isn&#39;t required to use these best practices, but trying to do TDD without
using them is painful to next to impossible.&lt;/span&gt;</description><link>http://bob-the-janitor.blogspot.com/2012/01/test-driven-development-from-management.html</link><author>noreply@blogger.com (Bob The Janitor)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-4279557173035583731</guid><pubDate>Sun, 27 Nov 2011 10:55:00 +0000</pubDate><atom:updated>2011-11-27T04:03:56.516-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">javascript</category><category domain="http://www.blogger.com/atom/ns#">Jquery</category><category domain="http://www.blogger.com/atom/ns#">MVC</category><title>More Ajax with MVC – Using Partial Views with Ajax</title><description>One the the really nice features in asp.net mvc is the ability to use partial views, not only for breaking up pages and reusing content but also for doing Ajax calls.&amp;nbsp; In &lt;a href=&quot;http://bob-the-janitor.blogspot.com/2010/12/easy-ajax-with-aspnet-mvc-and-jquery.html&quot; target=&quot;_blank&quot;&gt;Easy Ajax with ASP.NET MVC and jQuery&lt;/a&gt; I showed you how to do a basic Ajax call and display the data returned, now I’m going to show you something a little more useful, actually retuning content to display on the page.&lt;br /&gt;
First we take this partial view &lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; @using SampleApplication.Models&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060;&quot;&gt;   2:&lt;/span&gt; @model PartialModel&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   4:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   5:&lt;/span&gt;     @Model.Text&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060;&quot;&gt;   6:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum7&quot; style=&quot;color: #606060;&quot;&gt;   7:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;input&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;button&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;click me&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;onclick&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;UpdateView();return false;&quot;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
Then we add it to the main view like this&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;UpdateableContent&quot;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060;&quot;&gt;   2:&lt;/span&gt;     @{ Html.RenderPartial(&quot;Partial&quot;,new PartialModel{Text = &quot;Before Clicked&quot;}); }&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
Next we need to have a Action to call that returns the rendered view with updates&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; public ActionResult UpdatePartial()&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060;&quot;&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt;     var model = new PartialModel() {Text = &quot;was updated&quot;};&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   4:&lt;/span&gt;     return View(&quot;Partial&quot;, model);&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   5:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
In this case we update the model and return the specified partial view with the updated model.&lt;br /&gt;
&lt;br /&gt;
Last we have the Javascript that makes the Ajax call&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom-color: silver; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: silver; border-left-style: solid; border-left-width: 1px; border-right-color: silver; border-right-style: solid; border-right-width: 1px; border-top-color: silver; border-top-style: solid; border-top-width: 1px; cursor: text; direction: ltr; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 20px; max-height: 200px; overflow-x: auto; overflow-y: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; function UpdateView() {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060;&quot;&gt;   2:&lt;/span&gt;     var model = { };&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt;     $.post(&quot;/home/UpdatePartial&quot;,&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   4:&lt;/span&gt;         model,&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   5:&lt;/span&gt;         function (data) {&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060;&quot;&gt;   6:&lt;/span&gt;             $(&quot;#UpdateableContent&quot;).html(data);&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum7&quot; style=&quot;color: #606060;&quot;&gt;   7:&lt;/span&gt;         });&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum8&quot; style=&quot;color: #606060;&quot;&gt;   8:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
it’s fairly simple and a lot like what we did in the Easy Ajax post, the major difference is we take the returned rendered partial view and replace the existing rendering of the partial view using JQuery’s .html(),&amp;nbsp; this replaces the existing content with the passed in content. &amp;nbsp;This is a very simple and effective way to manipulate your pages.&lt;br /&gt;
&lt;br /&gt;
As always here is the &lt;a href=&quot;http://bob-the-janitor-sample-code.googlecode.com/svn/trunk/SampleApplication/SampleApplication/&quot; target=&quot;_blank&quot;&gt;source code&lt;/a&gt; for a sample project using it</description><link>http://bob-the-janitor.blogspot.com/2011/11/more-ajax-with-mvc-using-partial-views.html</link><author>noreply@blogger.com (Bob The Janitor)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-4742290714164384075</guid><pubDate>Sun, 17 Jul 2011 05:38:00 +0000</pubDate><atom:updated>2011-07-19T17:22:26.466-06:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">Best Practices</category><category domain="http://www.blogger.com/atom/ns#">Data Access</category><title>Using FluentMigrator with nAnt</title><description>On a project I was working on a while ago, we all had local copies of the DB in versioned .sql files, and then every time we did an update we would run the sql in the DB files and hope it build the DB.&lt;br /&gt;
More often then not it would blow up and so I would spend the first 1/2 hour every time I worked on the project getting things to work again. Well no more!&amp;nbsp; &lt;br /&gt;
FluentMigrator is based on Ruby Migrations, with a fairly simple syntax. The db classes have the attribute [Migration()] that specifies the version, and inherit from the Migration class, and override the two methods Up and Down.&lt;br /&gt;
&lt;style type=&quot;text/css&quot;&gt;
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, &quot;Courier New&quot;, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.codebox {
border: solid 1px black;
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;  &lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; [Migration(20110624232410)]&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060;&quot;&gt;   2:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt; AddUserTables : Migration&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   4:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;override&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Up()&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   5:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060;&quot;&gt;   6:&lt;/span&gt;         Create.Table(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Users&quot;&lt;/span&gt;)&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum7&quot; style=&quot;color: #606060;&quot;&gt;   7:&lt;/span&gt;             .WithColumn(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Id&quot;&lt;/span&gt;).AsInt32().Identity().NotNullable()&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum8&quot; style=&quot;color: #606060;&quot;&gt;   8:&lt;/span&gt;             .WithColumn(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Name&quot;&lt;/span&gt;).AsString().NotNullable()&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum9&quot; style=&quot;color: #606060;&quot;&gt;   9:&lt;/span&gt;             .WithColumn(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Password&quot;&lt;/span&gt;).AsAnsiString().NotNullable();&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum10&quot; style=&quot;color: #606060;&quot;&gt;  10:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum11&quot; style=&quot;color: #606060;&quot;&gt;  11:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum12&quot; style=&quot;color: #606060;&quot;&gt;  12:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;override&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Down()&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum13&quot; style=&quot;color: #606060;&quot;&gt;  13:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum14&quot; style=&quot;color: #606060;&quot;&gt;  14:&lt;/span&gt;         Delete.Table(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Users&quot;&lt;/span&gt;);&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum15&quot; style=&quot;color: #606060;&quot;&gt;  15:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum16&quot; style=&quot;color: #606060;&quot;&gt;  16:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;h5&gt;&lt;b&gt;Migrating Up and Down&lt;/b&gt;&lt;/h5&gt;The Reason for the Up and Down methods is very simple; if the version your migrating to is higher then the version of this class it executes the code in the Up method and if the version is lower then the code in the Down method executes.&amp;nbsp; Basically whatever you do in the Up is undone in the Down.&lt;br /&gt;
&lt;h5&gt;&lt;b&gt;Setting The Version Number&lt;/b&gt;&lt;/h5&gt;Something else you may have noticed is in the Migration tag the version number is fairly large, to make versioning easier on a team, I’m not using consecutive numbers but the date and time(using 24 hour time) of when the I added this class, so the the example class I created was on 6/24/2011 at 23:24 10. The current version number is also stored in the DB, making it very simple to see what DB version you’re on, this can come in handy if your code is based on a specific DB version you can do a simple check to see if you have the correct DB version.&lt;br /&gt;
&lt;h5&gt;Keeping version iterations small&lt;/h5&gt;Just like when creating a business logic class, you should follow the single responsibility principal, and have each class do only one thing, this may mean having a lot of classes but on the other side it will make it a lot easier to keep track of what each version added, modified, or removed.&lt;br /&gt;
&lt;h5&gt;Adding stuff to the Data Base&lt;/h5&gt;Using the Fluent api allows you to very smoothly add tables, columns etc. in a very readable way.&amp;nbsp; If you look at the Up method in the above example you can see how easy it is to add a table with columns.&amp;nbsp; This makes it very easy to add your own extension methods to short had it even further.&amp;nbsp; Here is an example for creating an identity column and a table with time stamps:&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; internal &lt;span style=&quot;color: blue;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt; MigrationExtensions&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060;&quot;&gt;   2:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;static&lt;/span&gt; ICreateTableColumnOptionOrWithColumnSyntax WithIdColumn(this ICreateTableWithColumnSyntax tableWithColumnSyntax)&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   4:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   5:&lt;/span&gt;         &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; tableWithColumnSyntax&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060;&quot;&gt;   6:&lt;/span&gt;             .WithColumn(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Id&quot;&lt;/span&gt;)&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum7&quot; style=&quot;color: #606060;&quot;&gt;   7:&lt;/span&gt;             .AsInt32()&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum8&quot; style=&quot;color: #606060;&quot;&gt;   8:&lt;/span&gt;             .NotNullable()&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum9&quot; style=&quot;color: #606060;&quot;&gt;   9:&lt;/span&gt;             .PrimaryKey()&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum10&quot; style=&quot;color: #606060;&quot;&gt;  10:&lt;/span&gt;             .Identity();&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum11&quot; style=&quot;color: #606060;&quot;&gt;  11:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum12&quot; style=&quot;color: #606060;&quot;&gt;  12:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum13&quot; style=&quot;color: #606060;&quot;&gt;  13:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;static&lt;/span&gt; ICreateTableColumnOptionOrWithColumnSyntax WithTimeStamps(this ICreateTableWithColumnSyntax tableWithColumnSyntax)&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum14&quot; style=&quot;color: #606060;&quot;&gt;  14:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum15&quot; style=&quot;color: #606060;&quot;&gt;  15:&lt;/span&gt;         &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; tableWithColumnSyntax&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum16&quot; style=&quot;color: #606060;&quot;&gt;  16:&lt;/span&gt;             .WithColumn(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;CreatedAt&quot;&lt;/span&gt;).AsDateTime().NotNullable()&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum17&quot; style=&quot;color: #606060;&quot;&gt;  17:&lt;/span&gt;             .WithColumn(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;ModifiedAt&quot;&lt;/span&gt;).AsDateTime().NotNullable();&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum18&quot; style=&quot;color: #606060;&quot;&gt;  18:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum19&quot; style=&quot;color: #606060;&quot;&gt;  19:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;But the api doesn&#39;t have everything you need so you have the option of adding in strait sql using Execute.Sql(). like this example:&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; Execute.Sql(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;DELETE FROM `Users` WHERE Name = &#39;TestUser&#39;&quot;&lt;/span&gt;);&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;also you can call sql files like this:&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; Execute.Script(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;myscript.sql&quot;&lt;/span&gt;);&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;h5&gt;Adding Data&lt;/h5&gt;The next step is to add some data. This could be some sample data for development, a larger dataset for QA, QA data for a specific type of customer, or base data for production.&amp;nbsp; By adding profiles you can abstract away what data you want to add for specific function. This is not where you add data for things the should be constant, things like lookup tables should be handled by a versioned migration class.&amp;nbsp; Here is an example of a profile class:&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; [Profile(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Development&quot;&lt;/span&gt;)]&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060;&quot;&gt;   2:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt; DevelopmentProfile : Migration&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   4:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;override&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Up()&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   5:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060;&quot;&gt;   6:&lt;/span&gt;             &lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum7&quot; style=&quot;color: #606060;&quot;&gt;   7:&lt;/span&gt;         Insert.IntoTable(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Users&quot;&lt;/span&gt;).Row(&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; {Name = &lt;span style=&quot;color: #006080;&quot;&gt;&quot;TestUser&quot;&lt;/span&gt;, Password=&lt;span style=&quot;color: #006080;&quot;&gt;&quot;12345&quot;&lt;/span&gt;});&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum8&quot; style=&quot;color: #606060;&quot;&gt;   8:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum9&quot; style=&quot;color: #606060;&quot;&gt;   9:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum10&quot; style=&quot;color: #606060;&quot;&gt;  10:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;override&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Down()&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum11&quot; style=&quot;color: #606060;&quot;&gt;  11:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum12&quot; style=&quot;color: #606060;&quot;&gt;  12:&lt;/span&gt;         Execute.Sql(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;DELETE FROM `Users` WHERE Name = &#39;TestUser&#39;&quot;&lt;/span&gt;);&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum13&quot; style=&quot;color: #606060;&quot;&gt;  13:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum14&quot; style=&quot;color: #606060;&quot;&gt;  14:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;Just like a Version class it inherits from the Migration class and has an up and a down method, this way when you add one profile it will remove the other profiles. &lt;br /&gt;
&lt;h5&gt;Deploying/Migrating Your Data Base&lt;/h5&gt;Deploying or Migrating your data can be done with a console app or with a build runner like MSBuild, nAnt, or Rake making it easy to integrate into your existing build process.&amp;nbsp; For this example we are going to use nAnt.&amp;nbsp; Here is an example nAnt build file:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: maroon;&quot;&gt;xml&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;version&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;1.0&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;encoding&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;UTF-8&quot;&lt;/span&gt; ?&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060;&quot;&gt;   2:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;project&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;FluentMigratorProof&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;xmlns&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;http://nant.sourceforge.net/release/0.90/nant.xsd&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;default&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;migrate-Production&quot;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt;   &amp;lt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;loadtasks&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;assembly&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;./FluentMigrator.NAnt.dll&quot;&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   4:&lt;/span&gt;   &lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;target&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Reset&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;description&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Migrate the database to the base version&quot;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   5:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;migrate&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060;&quot;&gt;   6:&lt;/span&gt;     &lt;span style=&quot;color: red;&quot;&gt;database&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;sql&quot;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum7&quot; style=&quot;color: #606060;&quot;&gt;   7:&lt;/span&gt;     &lt;span style=&quot;color: red;&quot;&gt;connection&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Data Source=DevBOX\SQLEXPRESS;Initial Catalog=FluentMigratorProof;User Id=BuildUser;Password=xxxxxxx;&quot;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum8&quot; style=&quot;color: #606060;&quot;&gt;   8:&lt;/span&gt;     &lt;span style=&quot;color: red;&quot;&gt;namespace&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;FluentMigratorProof&quot;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum9&quot; style=&quot;color: #606060;&quot;&gt;   9:&lt;/span&gt;     &lt;span style=&quot;color: red;&quot;&gt;target&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;./FluentMigratorProof.dll&quot;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum10&quot; style=&quot;color: #606060;&quot;&gt;  10:&lt;/span&gt;     &lt;span style=&quot;color: red;&quot;&gt;task&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;rollback:all&quot;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum11&quot; style=&quot;color: #606060;&quot;&gt;  11:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum12&quot; style=&quot;color: #606060;&quot;&gt;  12:&lt;/span&gt;   &lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: maroon;&quot;&gt;target&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum13&quot; style=&quot;color: #606060;&quot;&gt;  13:&lt;/span&gt;   &lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;target&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;migrate-Production&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;description&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Migrate the database to the latest version&quot;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum14&quot; style=&quot;color: #606060;&quot;&gt;  14:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;migrate&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum15&quot; style=&quot;color: #606060;&quot;&gt;  15:&lt;/span&gt;     &lt;span style=&quot;color: red;&quot;&gt;database&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;sql&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum16&quot; style=&quot;color: #606060;&quot;&gt;  16:&lt;/span&gt;     &lt;span style=&quot;color: red;&quot;&gt;connection&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Data Source=Production\SQLEXPRESS;Initial Catalog=FluentMigratorProof;User Id=BuildUser;Password=xxxxxxx;&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum17&quot; style=&quot;color: #606060;&quot;&gt;  17:&lt;/span&gt;     &lt;span style=&quot;color: red;&quot;&gt;namespace&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;FluentMigratorProof&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum18&quot; style=&quot;color: #606060;&quot;&gt;  18:&lt;/span&gt;     &lt;span style=&quot;color: red;&quot;&gt;target&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;./FluentMigratorProof.dll&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum19&quot; style=&quot;color: #606060;&quot;&gt;  19:&lt;/span&gt;     &lt;span style=&quot;color: red;&quot;&gt;profile&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Production&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum20&quot; style=&quot;color: #606060;&quot;&gt;  20:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum21&quot; style=&quot;color: #606060;&quot;&gt;  21:&lt;/span&gt;   &lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: maroon;&quot;&gt;target&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum22&quot; style=&quot;color: #606060;&quot;&gt;  22:&lt;/span&gt;   &lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;target&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;migrate-Development&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;description&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Migrate the database to the latest version&quot;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum23&quot; style=&quot;color: #606060;&quot;&gt;  23:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;migrate&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum24&quot; style=&quot;color: #606060;&quot;&gt;  24:&lt;/span&gt;     &lt;span style=&quot;color: red;&quot;&gt;database&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;sql&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum25&quot; style=&quot;color: #606060;&quot;&gt;  25:&lt;/span&gt;     &lt;span style=&quot;color: red;&quot;&gt;connection&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Data Source=DevBOX\SQLEXPRESS;Initial Catalog=FluentMigratorProof;User Id=BuildUser;Password=xxxxxx;&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum26&quot; style=&quot;color: #606060;&quot;&gt;  26:&lt;/span&gt;     &lt;span style=&quot;color: red;&quot;&gt;namespace&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;FluentMigratorProof&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum27&quot; style=&quot;color: #606060;&quot;&gt;  27:&lt;/span&gt;     &lt;span style=&quot;color: red;&quot;&gt;target&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;./FluentMigratorProof&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum28&quot; style=&quot;color: #606060;&quot;&gt;  28:&lt;/span&gt;     &lt;span style=&quot;color: red;&quot;&gt;profile&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Development&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum29&quot; style=&quot;color: #606060;&quot;&gt;  29:&lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum30&quot; style=&quot;color: #606060;&quot;&gt;  30:&lt;/span&gt;   &lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: maroon;&quot;&gt;target&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum31&quot; style=&quot;color: #606060;&quot;&gt;  31:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: maroon;&quot;&gt;project&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;To use FluentMigrator with nAnt you use loadtask to specify the FluentMigrator.dll then you add a migrate task in your target.&amp;nbsp; Your migrate task will need to have the following properties:&lt;/div&gt;&lt;ul style=&quot;color: black;&quot;&gt;&lt;li&gt;database – this specifies the type of DB (sql, oracle, sqllight, mysql, etc.) &lt;/li&gt;
&lt;li&gt;connection – this specifies the DataBase your going to connect to and with what permissions &lt;/li&gt;
&lt;li&gt;namespace – this is the application namespace your going to run allowing you to migrate multiple DB in the same project &lt;/li&gt;
&lt;li&gt;target – this is the .Dll you’re calling to migrate from &lt;/li&gt;
&lt;li&gt;Profile – this is what profile your loading &lt;/li&gt;
&lt;li&gt;task(optional) – this is how you specify what version you want to build, or if you want to roll back, etc. &lt;/li&gt;
&lt;/ul&gt;&lt;div style=&quot;color: black;&quot;&gt;Then to run your migration simply run NAnt.exe with the name of your build file something like:&lt;/div&gt;&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; NAnt.exe -buildfile:ProofBuild.nant.build&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;A full explanation of using nAnt is a little out of scope for this blog post so if you want more info on nAnt see &lt;a href=&quot;http://nant.sourceforge.net/release/latest/help/&quot; target=&quot;_blank&quot;&gt;nAnt Help Page&lt;/a&gt;.&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;As always here is a &lt;a href=&quot;http://bob-the-janitor-sample-code.googlecode.com/svn/trunk/FluentMigratorProof/&quot; target=&quot;_blank&quot;&gt;sample project&lt;/a&gt; using this.&lt;/div&gt;</description><link>http://bob-the-janitor.blogspot.com/2011/07/using-fluentmigrator-with-nant.html</link><author>noreply@blogger.com (Bob The Janitor)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-4743656165214573031</guid><pubDate>Thu, 14 Jul 2011 06:03:00 +0000</pubDate><atom:updated>2011-07-14T00:03:53.176-06:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">Blogging</category><category domain="http://www.blogger.com/atom/ns#">Development</category><title>Where is the passion?</title><description>On the 4th of&amp;nbsp;July&amp;nbsp;I had a really good conversation with @jamis a former member of the rails core team and a fairly prominent member of the ruby&amp;nbsp;community&amp;nbsp;and I was reminded how much the Ruby community appers to be more dedicated to craftmanship then the .net community as a whole.&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
This may be just an outsiders view but ruby devs seem to be more dedicated to pair programing,&amp;nbsp; TDD, CI, etc.&amp;nbsp; and basicly more interested in&amp;nbsp;writing&amp;nbsp;software to make a living vs. where in the dot net comunity it feels &amp;nbsp;more like developers write software just to make a living, there are a few leaders that&amp;nbsp; that push these ideas, but for the most part it seem more previlant in the ruby community.&lt;br /&gt;
&lt;br /&gt;
So my real question is, why?&amp;nbsp; is the ruby stack just more attractive to people of this disposion?&amp;nbsp; is it just becouse dot net is just more widely used and thus just has a wider spectrum of developers in it? &amp;nbsp;Is it just becouse I have a very limmited view of the ruby community and only seeing the cream of the crop, or am I just somewhat jaded and only seeing the negative in the .net community?&amp;nbsp; To this I don&#39;t have a good&amp;nbsp;answer.&lt;br /&gt;
&amp;nbsp;  &lt;br /&gt;
So the next question is how do we get the passion in the .NET dev stack?&amp;nbsp; it&#39;s not like there is a lack of interesting things to learn and build, can we do more community work?&amp;nbsp; Boise has a .NET user group (netdug), a software developers group(bsdg) that is mostly .net developers, and a code camp every year, but for the most part it&#39;s the same people group presenting.&amp;nbsp; my open question to the group is how do we get more&amp;nbsp;people&amp;nbsp;interested in presenting, do we start younger? maybe start youth dev groups? maybe as a group pressure each other to be more active?&amp;nbsp; For my part, I need to step up and do my part, and rededicate myself to blogging.</description><link>http://bob-the-janitor.blogspot.com/2011/07/where-is-passion.html</link><author>noreply@blogger.com (Bob The Janitor)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-6491478309939917744</guid><pubDate>Mon, 23 May 2011 14:02:00 +0000</pubDate><atom:updated>2011-05-23T08:02:52.245-06:00</atom:updated><title>Decoupling to Destruction</title><description>&lt;p&gt;One of the core concepts of well architected code is being decoupled, but like so many of the good things in life if you do it to much it becomes bad for you.&lt;/p&gt;  &lt;p&gt;Recently I worked on a piece if legacy code that from the UI to the Dal it passed an object though 7 classes and was converted from one object to the next 5 times.&amp;#160;&amp;#160; Their wasn’t any real difference from one object to the next.&amp;#160; In some cases it was pulled from the data object and each item was passed as a parameter into a method where it was then put into a new object.&amp;#160; The result was next to imposable to debug, even harder to read, and in a lot of places just plain sloppy.&amp;#160; &lt;/p&gt;  &lt;p&gt;In an earlier post &lt;a href=&quot;http://bob-the-janitor.blogspot.com/2009/07/n-tier-design-revisit-part-2-data.html&quot; target=&quot;_blank&quot;&gt;N-Tier Design Revisit part 2 – Data Entities&lt;/a&gt;&amp;#160; I talked about how data entities, poco, or dto (they are all basically the same thing more or less) work, they go from the UI though the Biz and to the Dal and back again.&amp;#160; This creates a message that is passed, your code is still decoupled because the Data Entity basally contains no logic, it’s just holding data.&amp;#160; &lt;/p&gt;  &lt;p&gt;Wring an application is kind of like growing a garden, if you take care of it and maintain it, it stays nice and easy to maintain.&amp;#160; If you neglect it it becomes difficult to maintain and will over time die.&amp;#160; Decoupling is one of the things you do to make it easy to maintain your application, kind of like watering it, and just like watering it if you do it to much you’ll kill it.&lt;/p&gt;  </description><link>http://bob-the-janitor.blogspot.com/2011/05/decoupling-to-destruction.html</link><author>noreply@blogger.com (Bob The Janitor)</author><thr:total>0</thr:total></item></channel></rss>