<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>MuellerDesigns.net</title>
    <link>http://www.muellerdesigns.net/dasblog/</link>
    <description>Alex Mueller on Software and Technology</description>
    <language>en-us</language>
    <copyright>MuellerDesigns.net</copyright>
    <lastBuildDate>Mon, 30 Jun 2008 22:15:53 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.0.7226.0</generator>
    <managingEditor>muellerdesigns@gmail.com</managingEditor>
    <webMaster>muellerdesigns@gmail.com</webMaster>
    <item>
      <trackback:ping>http://www.muellerdesigns.net/dasblog/Trackback.aspx?guid=16ab23c3-7003-42dc-9f2a-815100a02d18</trackback:ping>
      <pingback:server>http://www.muellerdesigns.net/dasblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.muellerdesigns.net/dasblog/PermaLink,guid,16ab23c3-7003-42dc-9f2a-815100a02d18.aspx</pingback:target>
      <dc:creator>Alex Mueller</dc:creator>
      <wfw:comment>http://www.muellerdesigns.net/dasblog/CommentView,guid,16ab23c3-7003-42dc-9f2a-815100a02d18.aspx</wfw:comment>
      <wfw:commentRss>http://www.muellerdesigns.net/dasblog/SyndicationService.asmx/GetEntryCommentsRss?guid=16ab23c3-7003-42dc-9f2a-815100a02d18</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I have spent the past couple weeks holed up in a cave building a web site using the
latest ASP.NET MVC framework. I am behind on blogging, responding to emails, and keeping
up with my RSS feeds. I am making good progress with ASP.NET's MVC framework and enjoying
the development experience, despite the occasional beta blip. 
</p>
        <p>
I started developing a site using the MVC Preview 2 source. Two weeks in, I pulled
the latest <a title="MvcContrib" href="http://www.codeplex.com/MVCContrib" target="_blank">MvcContrib</a> project,
and a few days ago I upgraded again to the MVC Preview 3 source. Like anyone using
beta software, I have spent some time swearing at my screen, but overall, I am pleased
with the MVC framework. After returning from vacation, I now find that I am one more
release behind on my MvcContrib binaries.
</p>
        <p>
As I began developing with the MVC framework, the similarities I was seeing with <a href="http://www.castleproject.org/monorail/index.html" target="_blank">Castle's
MonoRail</a> MVC were numerous and reassuring. I felt like I could hit the ground
running with previous MVC knowledge. The sample MVC application right out of the box
is functional and a helpful place to start familiarizing and education oneself with
the new framework. For those tools and features that are not built into the framework
at this point, I found the MvcContrib project to be helpful in my development. 
</p>
        <p>
It seemed like with each day of development I would discover something new, cool,
or exciting, and I wanted to share it on this blog. As I started down the path of
writing a blog entry, I procrastinated each time thinking, "let me just get through
this one issue first and then I will blog." That approach snowballed tremendously.
With each hurdle I had to surpass, there was another release I had to install. Of
course, I did not have to install any of these updates, but I did thinking they would
be trivial. In some cases they were, and in some they were not. My point - there is
a great deal of change and development constantly occurring on the MVC framework and
other tools supporting it. Expect this rate of change while the framework is maturing.
Sometimes it is frustrating, but there is great support on the <a title="ASP.NET/MVC" href="http://www.asp.net/mvc/" target="_blank">ASP.NET/MVC</a> forums
as well as <a title="MvcContrib" href="http://groups.google.com/group/mvccontrib-discuss" target="_blank">MvcContrib</a>.
</p>
        <p>
          <strong>
          </strong> 
</p>
        <p>
          <strong>Why do I like it?</strong>
        </p>
        <p>
MVC promotes a cleaner separation of concerns. Since I am used to developing in ASP.NET
and trying to adhere to a loosely defined MVP pattern, this MVC framework mitigates
some of the frustrations of having to enforce the pattern as well as SoC. 
</p>
        <p>
Testability is build into the framework. When creating a new project, there is an
option to create a test project to accompany it. 
</p>
        <p>
I can create a web site quickly and cleanly. As I add a new page (view), I have a
distinct controller and view for it. Unlike MVP implemented in ASP.NET, I do not have
to enforce my controller-view separation, it is done for me. 
</p>
        <p>
I am able to use use more than one view engine easily. I am tired of using the ASP.NET
view engine. While one can roll their own view engine flavor, MvcContrib provides
support for a few out of the box. I can free myself of having to use ASPX pages, ASCX
user controls, and their code-behind files. 
</p>
        <p>
I prefer using the <a href="http://nvelocity.sourceforge.net/" target="_blank">NVelocity</a> view
engine. I prefer the more simple HTML view of NVelocity. My customers enjoy it as
well, and they do not have to concern themselves with ASP syntax. They will have to
learn a few tricks with NVelocity, but nothing that is not intuitive as it is.
</p>
        <p>
Extensible source. I have been able to add custom support to provide overrides and
additional functionality to the framework as I need it.
</p>
        <p>
Community support. The MvcContrib project helps make development with MVC easier.
Use their view engines and IoC container support. Know of some functionality that
is not available, add it. 
</p>
        <p>
          <strong>
          </strong> 
</p>
        <p>
          <strong>Pitfalls</strong>
        </p>
        <p>
IIS 6 and URL rewriting. While it is possible to get the nice URL rewriting to work
with IIS 6, ISAPI filters, and extension mappings. It is a PITA. I am in the process
of upgrading my customer's environment to use IIS 7. Today, their URL contains the
".mvc" string, such as, &lt;domainName&gt;/home.mvc, or &lt;domainName&gt;/account.mvc/login.
I suggest having IIS 7 available.
</p>
        <p>
Ajax framework. I am still waiting on a good Ajax framework to be included. The one
MonoRail includes is nice. As for now, I am using jQuery and developing my own. Hmmm,
maybe this functionality could be added to the MvcContrib project, and maybe instead
of limiting it to jQuery, I could abstract it to enable other Ajax providers. We'll
see what time permits.
</p>
        <p>
Third party controls like Telerik, Infragistics, et alia. Rich datagrids, tree controls,
and other controls that rely on view state and postbacks. I expect support will come
around for these.
</p>
        <p>
I tried the <a href="http://andrewpeters.net/2007/12/19/introducing-nhaml-an-aspnet-mvc-view-engine/" target="_blank">NHaml</a> view
engine, a .NET implementation of the Rails Haml view engine. My NHaml default layout
(master page) was generating runtime errors because I was not use the proper spacing
of two characters. Seriously? Two spaces? Who cares. I moved on to try Brail.
</p>
        <p>
 
</p>
        <p>
I have been pleased thus far. Thank you to the ASP.NET MVC team and the contributors
to the MvcContrib project. Keep up the great work. 
</p>
        <img width="0" height="0" src="http://www.muellerdesigns.net/dasblog/aggbug.ashx?id=16ab23c3-7003-42dc-9f2a-815100a02d18" />
      </body>
      <title>Working with ASP.NET MVC and MvcContrib</title>
      <guid isPermaLink="false">http://www.muellerdesigns.net/dasblog/PermaLink,guid,16ab23c3-7003-42dc-9f2a-815100a02d18.aspx</guid>
      <link>http://www.muellerdesigns.net/dasblog/2008/06/30/WorkingWithASPNETMVCAndMvcContrib.aspx</link>
      <pubDate>Mon, 30 Jun 2008 22:15:53 GMT</pubDate>
      <description>&lt;p&gt;
I have spent the past couple weeks holed up in a cave building a web site using the
latest ASP.NET MVC framework. I am behind on blogging, responding to emails, and keeping
up with my RSS feeds. I am making good progress with ASP.NET's MVC framework and enjoying
the development experience, despite the occasional beta blip. 
&lt;/p&gt;
&lt;p&gt;
I started developing a site using the MVC Preview 2 source. Two weeks in, I pulled
the latest &lt;a title="MvcContrib" href="http://www.codeplex.com/MVCContrib" target="_blank"&gt;MvcContrib&lt;/a&gt; project,
and a few days ago I upgraded again to the MVC Preview 3 source. Like anyone using
beta software, I have spent some time swearing at my screen, but overall, I am pleased
with the MVC framework. After returning from vacation, I now find that I am one more
release behind on my MvcContrib binaries.
&lt;/p&gt;
&lt;p&gt;
As I began developing with the MVC framework, the similarities I was seeing with &lt;a href="http://www.castleproject.org/monorail/index.html" target="_blank"&gt;Castle's
MonoRail&lt;/a&gt; MVC were numerous and reassuring. I felt like I could hit the ground
running with previous MVC knowledge. The sample MVC application right out of the box
is functional and a helpful place to start familiarizing and education oneself with
the new framework. For those tools and features that are not built into the framework
at this point, I found the MvcContrib project to be helpful in my development. 
&lt;/p&gt;
&lt;p&gt;
It seemed like with each day of development I would discover something new, cool,
or exciting, and I wanted to share it on this blog. As I started down the path of
writing a blog entry, I procrastinated each time thinking, "let me just get through
this one issue first and then I will blog." That approach snowballed tremendously.
With each hurdle I had to surpass, there was another release I had to install. Of
course, I did not have to install any of these updates, but I did thinking they would
be trivial. In some cases they were, and in some they were not. My point - there is
a great deal of change and development constantly occurring on the MVC framework and
other tools supporting it. Expect this rate of change while the framework is maturing.
Sometimes it is frustrating, but there is great support on the &lt;a title="ASP.NET/MVC" href="http://www.asp.net/mvc/" target="_blank"&gt;ASP.NET/MVC&lt;/a&gt; forums
as well as &lt;a title="MvcContrib" href="http://groups.google.com/group/mvccontrib-discuss" target="_blank"&gt;MvcContrib&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Why do I like it?&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
MVC promotes a cleaner separation of concerns. Since I am used to developing in ASP.NET
and trying to adhere to a loosely defined MVP pattern, this MVC framework mitigates
some of the frustrations of having to enforce the pattern as well as SoC. 
&lt;/p&gt;
&lt;p&gt;
Testability is build into the framework. When creating a new project, there is an
option to create a test project to accompany it. 
&lt;/p&gt;
&lt;p&gt;
I can create a web site quickly and cleanly. As I add a new page (view), I have a
distinct controller and view for it. Unlike MVP implemented in ASP.NET, I do not have
to enforce my controller-view separation, it is done for me. 
&lt;/p&gt;
&lt;p&gt;
I am able to use use more than one view engine easily. I am tired of using the ASP.NET
view engine. While one can roll their own view engine flavor, MvcContrib provides
support for a few out of the box. I can free myself of having to use ASPX pages, ASCX
user controls, and their code-behind files. 
&lt;/p&gt;
&lt;p&gt;
I prefer using the &lt;a href="http://nvelocity.sourceforge.net/" target="_blank"&gt;NVelocity&lt;/a&gt; view
engine. I prefer the more simple HTML view of NVelocity. My customers enjoy it as
well, and they do not have to concern themselves with ASP syntax. They will have to
learn a few tricks with NVelocity, but nothing that is not intuitive as it is.
&lt;/p&gt;
&lt;p&gt;
Extensible source. I have been able to add custom support to provide overrides and
additional functionality to the framework as I need it.
&lt;/p&gt;
&lt;p&gt;
Community support. The MvcContrib project helps make development with MVC easier.
Use their view engines and IoC container support. Know of some functionality that
is not available, add it. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Pitfalls&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
IIS 6 and URL rewriting. While it is possible to get the nice URL rewriting to work
with IIS 6, ISAPI filters, and extension mappings. It is a PITA. I am in the process
of upgrading my customer's environment to use IIS 7. Today, their URL contains the
".mvc" string, such as, &amp;lt;domainName&amp;gt;/home.mvc, or &amp;lt;domainName&amp;gt;/account.mvc/login.
I suggest having IIS 7 available.
&lt;/p&gt;
&lt;p&gt;
Ajax framework. I am still waiting on a good Ajax framework to be included. The one
MonoRail includes is nice. As for now, I am using jQuery and developing my own. Hmmm,
maybe this functionality could be added to the MvcContrib project, and maybe instead
of limiting it to jQuery, I could abstract it to enable other Ajax providers. We'll
see what time permits.
&lt;/p&gt;
&lt;p&gt;
Third party controls like Telerik, Infragistics, et alia. Rich datagrids, tree controls,
and other controls that rely on view state and postbacks. I expect support will come
around for these.
&lt;/p&gt;
&lt;p&gt;
I tried the &lt;a href="http://andrewpeters.net/2007/12/19/introducing-nhaml-an-aspnet-mvc-view-engine/" target="_blank"&gt;NHaml&lt;/a&gt; view
engine, a .NET implementation of the Rails Haml view engine. My NHaml default layout
(master page) was generating runtime errors because I was not use the proper spacing
of two characters. Seriously? Two spaces? Who cares. I moved on to try Brail.
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
I have been pleased thus far. Thank you to the ASP.NET MVC team and the contributors
to the MvcContrib project. Keep up the great work. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.muellerdesigns.net/dasblog/aggbug.ashx?id=16ab23c3-7003-42dc-9f2a-815100a02d18" /&gt;</description>
      <comments>http://www.muellerdesigns.net/dasblog/CommentView,guid,16ab23c3-7003-42dc-9f2a-815100a02d18.aspx</comments>
    </item>
    <item>
      <trackback:ping>http://www.muellerdesigns.net/dasblog/Trackback.aspx?guid=2e60dcc4-ff02-4b38-aa22-3a637f9db8af</trackback:ping>
      <pingback:server>http://www.muellerdesigns.net/dasblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.muellerdesigns.net/dasblog/PermaLink,guid,2e60dcc4-ff02-4b38-aa22-3a637f9db8af.aspx</pingback:target>
      <dc:creator>Alex Mueller</dc:creator>
      <wfw:comment>http://www.muellerdesigns.net/dasblog/CommentView,guid,2e60dcc4-ff02-4b38-aa22-3a637f9db8af.aspx</wfw:comment>
      <wfw:commentRss>http://www.muellerdesigns.net/dasblog/SyndicationService.asmx/GetEntryCommentsRss?guid=2e60dcc4-ff02-4b38-aa22-3a637f9db8af</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I have been doing code reviews frequently this past week and have been remarking on
the naming conventions of test methods. In a effort to try and find the rules of BDD
naming conventions, I came across <a title="Dan North's introduction to BDD" href="http://dannorth.net/introducing-bdd" target="_blank">Dan
North's introduction to BDD</a>, which is a great starting point, and a blog post
by <a title="David Laribee" href="http://codebetter.com/blogs/david_laribee/archive/2007/12/17/approaching-bdd.aspx" target="_blank">David
Laribee</a> that has made a good impression on me. You can read up on BDD to learn
more, this post will not go into detail about it. 
</p>
        <p>
From what I gathered from David Laribee's <a title="article" href="http://codebetter.com/blogs/david_laribee/archive/2007/12/17/approaching-bdd.aspx" target="_blank">article</a>,
I like this. I REALLY like this. 
</p>
        <p>
          <img src="http://codebetter.com/blogs/david_laribee/WindowsLiveWriter/ApproachingBDD_AED1/resharper-specs_3.jpg" />
        </p>
        <p>
By changing namespace, class, and method names, the behavior of each spec (test) is
clearly revealed. In a larger suite of tests, if there are failures, I can more easily
see what is failing and what trends, if any, are resulting in my failures. Before,
I would name my test method names to describe a behavior, "Some concept should do
this when given that." Getting the namespace and class name involved provides a more
legible test result. 
</p>
        <p>
While reviewing a test case for a peer, I took this approach and arrived at the following
scenario. I am changing the names of the methods to hide details. The original test
method was "FilterToEndPointTestReport." Making this more readable, using my previous
approach, we arrived at "FilterShouldUpdateStatusOnReportWhenDefaultFilterValueIsChanged."
Great, that is better, but...
</p>
        <p>
Applying the approach described in David's post, I now have this.
</p>
        <div style="border-right: gray 1px solid; padding-right: 4px; padding-left: 4px; font-size: 8pt; border-top: gray 1px solid; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4">
          <div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
            <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">
              <span style="color: #606060"> 1:</span>
              <span style="color: #0000ff">namespace</span> Specs_for_Filters</pre>
            <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
              <span style="color: #606060"> 2:</span> {</pre>
            <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">
              <span style="color: #606060"> 3:</span>
              <span style="color: #0000ff">public</span>
              <span style="color: #0000ff">class</span> When_default_filter_value_is_changed
: FilterTestFixture</pre>
            <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
              <span style="color: #606060"> 4:</span> {</pre>
            <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">
              <span style="color: #606060"> 5:</span> [Test]</pre>
            <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
              <span style="color: #606060"> 6:</span>
              <span style="color: #0000ff">public</span>
              <span style="color: #0000ff">void</span> Endpoint_should_be_updated_on_report
{}</pre>
            <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">
              <span style="color: #606060"> 7:</span>
            </pre>
            <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
              <span style="color: #606060"> 8:</span> [Test]</pre>
            <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">
              <span style="color: #606060"> 9:</span>
              <span style="color: #0000ff">public</span>
              <span style="color: #0000ff">void</span> Endpoint_should_be_updated_on_grid
{}</pre>
            <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
              <span style="color: #606060"> 10:</span>
            </pre>
            <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">
              <span style="color: #606060"> 11:</span> [Test]</pre>
            <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
              <span style="color: #606060"> 12:</span>
              <span style="color: #0000ff">public</span>
              <span style="color: #0000ff">void</span> Endpoint_should_be_updated_on_chart
{}</pre>
            <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">
              <span style="color: #606060"> 13:</span> }</pre>
            <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
              <span style="color: #606060"> 14:</span>
            </pre>
            <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">
              <span style="color: #606060"> 15:</span>
              <span style="color: #0000ff">public</span>
              <span style="color: #0000ff">abstract</span>
              <span style="color: #0000ff">class</span> FilterTestFixture</pre>
            <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
              <span style="color: #606060"> 16:</span> {</pre>
            <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">
              <span style="color: #606060"> 17:</span>
              <span style="color: #008000">//
provide common functionality that will be used </span>
            </pre>
            <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
              <span style="color: #606060"> 18:</span>
              <span style="color: #008000">//
among behavior-driven filter test classes.</span>
            </pre>
            <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">
              <span style="color: #606060"> 19:</span> }</pre>
            <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
              <span style="color: #606060"> 20:</span> }</pre>
          </div>
        </div>
        <p>
When my tests run, their resulting output is more legible. This approach helps me
to think about my tests in terms of behavior rather than implementation. In my opinion,
my test cases are now more abstract and more succinct. 
</p>
        <img width="0" height="0" src="http://www.muellerdesigns.net/dasblog/aggbug.ashx?id=2e60dcc4-ff02-4b38-aa22-3a637f9db8af" />
      </body>
      <title>Thanks to BDD</title>
      <guid isPermaLink="false">http://www.muellerdesigns.net/dasblog/PermaLink,guid,2e60dcc4-ff02-4b38-aa22-3a637f9db8af.aspx</guid>
      <link>http://www.muellerdesigns.net/dasblog/2008/05/01/ThanksToBDD.aspx</link>
      <pubDate>Thu, 01 May 2008 18:48:23 GMT</pubDate>
      <description>&lt;p&gt;
I have been doing code reviews frequently this past week and have been remarking on
the naming conventions of test methods. In a effort to try and find the rules of BDD
naming conventions, I came across &lt;a title="Dan North's introduction to BDD" href="http://dannorth.net/introducing-bdd" target="_blank"&gt;Dan
North's introduction to BDD&lt;/a&gt;, which is a great starting point, and a blog post
by &lt;a title="David Laribee" href="http://codebetter.com/blogs/david_laribee/archive/2007/12/17/approaching-bdd.aspx" target="_blank"&gt;David
Laribee&lt;/a&gt; that has made a good impression on me. You can read up on BDD to learn
more, this post will not go into detail about it. 
&lt;/p&gt;
&lt;p&gt;
From what I gathered from David Laribee's &lt;a title="article" href="http://codebetter.com/blogs/david_laribee/archive/2007/12/17/approaching-bdd.aspx" target="_blank"&gt;article&lt;/a&gt;,
I like this. I REALLY like this. 
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://codebetter.com/blogs/david_laribee/WindowsLiveWriter/ApproachingBDD_AED1/resharper-specs_3.jpg"&gt; 
&lt;/p&gt;
&lt;p&gt;
By changing namespace, class, and method names, the behavior of each spec (test) is
clearly revealed. In a larger suite of tests, if there are failures, I can more easily
see what is failing and what trends, if any, are resulting in my failures. Before,
I would name my test method names to describe a behavior, "Some concept should do
this when given that." Getting the namespace and class name involved provides a more
legible test result. 
&lt;/p&gt;
&lt;p&gt;
While reviewing a test case for a peer, I took this approach and arrived at the following
scenario. I am changing the names of the methods to hide details. The original test
method was "FilterToEndPointTestReport." Making this more readable, using my previous
approach, we arrived at "FilterShouldUpdateStatusOnReportWhenDefaultFilterValueIsChanged."
Great, that is better, but...
&lt;/p&gt;
&lt;p&gt;
Applying the approach described in David's post, I now have this.
&lt;/p&gt;
&lt;div style="border-right: gray 1px solid; padding-right: 4px; padding-left: 4px; font-size: 8pt; border-top: gray 1px solid; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4"&gt;
&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt; 1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt; Specs_for_Filters&lt;/pre&gt;
&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt; 2:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt; 3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; When_default_filter_value_is_changed
: FilterTestFixture&lt;/pre&gt;
&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt; 4:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt; 5:&lt;/span&gt; [Test]&lt;/pre&gt;
&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt; 6:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Endpoint_should_be_updated_on_report
{}&lt;/pre&gt;
&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt; 7:&lt;/span&gt; &lt;/pre&gt;
&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt; 8:&lt;/span&gt; [Test]&lt;/pre&gt;
&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt; 9:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Endpoint_should_be_updated_on_grid
{}&lt;/pre&gt;
&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt; 10:&lt;/span&gt; &lt;/pre&gt;
&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt; 11:&lt;/span&gt; [Test]&lt;/pre&gt;
&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt; 12:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Endpoint_should_be_updated_on_chart
{}&lt;/pre&gt;
&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt; 13:&lt;/span&gt; }&lt;/pre&gt;
&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt; 14:&lt;/span&gt; &lt;/pre&gt;
&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt; 15:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;abstract&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; FilterTestFixture&lt;/pre&gt;
&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt; 16:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt; 17:&lt;/span&gt; &lt;span style="color: #008000"&gt;//
provide common functionality that will be used &lt;/span&gt;&lt;/pre&gt;
&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt; 18:&lt;/span&gt; &lt;span style="color: #008000"&gt;//
among behavior-driven filter test classes.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt; 19:&lt;/span&gt; }&lt;/pre&gt;
&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt; 20:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
When my tests run, their resulting output is more legible. This approach helps me
to think about my tests in terms of behavior rather than implementation. In my opinion,
my test cases are now more abstract and more succinct. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.muellerdesigns.net/dasblog/aggbug.ashx?id=2e60dcc4-ff02-4b38-aa22-3a637f9db8af" /&gt;</description>
      <comments>http://www.muellerdesigns.net/dasblog/CommentView,guid,2e60dcc4-ff02-4b38-aa22-3a637f9db8af.aspx</comments>
      <category>Design</category>
    </item>
    <item>
      <trackback:ping>http://www.muellerdesigns.net/dasblog/Trackback.aspx?guid=bc790b7d-f2bc-47e0-a5e8-465171c9b83c</trackback:ping>
      <pingback:server>http://www.muellerdesigns.net/dasblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.muellerdesigns.net/dasblog/PermaLink,guid,bc790b7d-f2bc-47e0-a5e8-465171c9b83c.aspx</pingback:target>
      <dc:creator>Alex Mueller</dc:creator>
      <wfw:comment>http://www.muellerdesigns.net/dasblog/CommentView,guid,bc790b7d-f2bc-47e0-a5e8-465171c9b83c.aspx</wfw:comment>
      <wfw:commentRss>http://www.muellerdesigns.net/dasblog/SyndicationService.asmx/GetEntryCommentsRss?guid=bc790b7d-f2bc-47e0-a5e8-465171c9b83c</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I am undecided on <a title="http://twitter.com" href="http://twitter.com" target="_blank">Twitter</a>.
The jury is still out in my mind. On any given day, there are things I need to do
and things I would like to do. Not taking into account family things, I read through
my emails, both work and personal, read through my RSS feeds, news feeds, weather
reports, IM with close friends and family, read a few credible news sources, and somewhere
find time to work and research new and existing technologies. If I can get that far,
that is a busy day, and that does not include family. 
</p>
        <p>
So where am I supposed to find time to update everyone on Twitter? How is Twitter
fitting into your schedule?
</p>
        <p>
          <a title="http://twitter.com/bamueller" href="http://twitter.com/bamueller" target="_blank">You
can follow me</a>, but I am not really all that active, at least until I find more
time. 
</p>
        <img width="0" height="0" src="http://www.muellerdesigns.net/dasblog/aggbug.ashx?id=bc790b7d-f2bc-47e0-a5e8-465171c9b83c" />
      </body>
      <title>Twitter</title>
      <guid isPermaLink="false">http://www.muellerdesigns.net/dasblog/PermaLink,guid,bc790b7d-f2bc-47e0-a5e8-465171c9b83c.aspx</guid>
      <link>http://www.muellerdesigns.net/dasblog/2008/04/30/Twitter.aspx</link>
      <pubDate>Wed, 30 Apr 2008 05:17:29 GMT</pubDate>
      <description>&lt;p&gt;
I am undecided on &lt;a title="http://twitter.com" href="http://twitter.com" target="_blank"&gt;Twitter&lt;/a&gt;.
The jury is still out in my mind. On any given day, there are things I need to do
and things I would like to do. Not taking into account family things, I read through
my emails, both work and personal, read through my RSS feeds, news feeds, weather
reports, IM with close friends and family, read a few credible news sources, and somewhere
find time to work and research new and existing technologies. If I can get that far,
that is a busy day, and that does not include family. 
&lt;/p&gt;
&lt;p&gt;
So where am I supposed to find time to update everyone on Twitter? How is Twitter
fitting into your schedule?
&lt;/p&gt;
&lt;p&gt;
&lt;a title="http://twitter.com/bamueller" href="http://twitter.com/bamueller" target="_blank"&gt;You
can follow me&lt;/a&gt;, but I am not really all that active, at least until I find more
time. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.muellerdesigns.net/dasblog/aggbug.ashx?id=bc790b7d-f2bc-47e0-a5e8-465171c9b83c" /&gt;</description>
      <comments>http://www.muellerdesigns.net/dasblog/CommentView,guid,bc790b7d-f2bc-47e0-a5e8-465171c9b83c.aspx</comments>
    </item>
    <item>
      <trackback:ping>http://www.muellerdesigns.net/dasblog/Trackback.aspx?guid=2f2caf81-44b8-46e6-8367-97a8ab76cabe</trackback:ping>
      <pingback:server>http://www.muellerdesigns.net/dasblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.muellerdesigns.net/dasblog/PermaLink,guid,2f2caf81-44b8-46e6-8367-97a8ab76cabe.aspx</pingback:target>
      <dc:creator>Alex Mueller</dc:creator>
      <wfw:comment>http://www.muellerdesigns.net/dasblog/CommentView,guid,2f2caf81-44b8-46e6-8367-97a8ab76cabe.aspx</wfw:comment>
      <wfw:commentRss>http://www.muellerdesigns.net/dasblog/SyndicationService.asmx/GetEntryCommentsRss?guid=2f2caf81-44b8-46e6-8367-97a8ab76cabe</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I was in a design discussion today and mentioned the need for a singleton object in
our solution. Further along in the discussion I was trying to find a word that describes
the opposite of a singleton, but alas, I struggled to find a word that may or may
not exist. I just referred to the inverse object as a "new object." As I pondered
this later in the day, I considered adjectives describing the nature of objects. They
can be many things, but two concepts that popped into my head to classify them were
"complex" and "simple." 
</p>
        <p>
I started playing with the words and making them resemble singleton. "Complexton"
did not sound right to me. I should mention that I was washing my hands as I was contemplating
this. I lifted up my head, looked into the mirror, and thought, "SIMPLETON." The opposite
of a singleton is a "simpleton." 
</p>
        <p>
If the opposite of a singleton is not a "simpleton," then what is it? Until I find
a plausible answer, I will try and insert this new term into my next design discussion. <img width="0" height="0" src="http://www.muellerdesigns.net/dasblog/aggbug.ashx?id=2f2caf81-44b8-46e6-8367-97a8ab76cabe" /></p>
      </body>
      <title>The Opposite of a Singleton?</title>
      <guid isPermaLink="false">http://www.muellerdesigns.net/dasblog/PermaLink,guid,2f2caf81-44b8-46e6-8367-97a8ab76cabe.aspx</guid>
      <link>http://www.muellerdesigns.net/dasblog/2008/04/18/TheOppositeOfASingleton.aspx</link>
      <pubDate>Fri, 18 Apr 2008 03:41:34 GMT</pubDate>
      <description>&lt;p&gt;
I was in a design discussion today and mentioned the need for a singleton object in
our solution. Further along in the discussion I was trying to find a word that describes
the opposite of a singleton, but alas, I struggled to find a word that may or may
not exist. I just referred to the inverse object as a "new object." As I pondered
this later in the day, I considered adjectives describing the nature of objects. They
can be many things, but two concepts that popped into my head to classify them were
"complex" and "simple." 
&lt;p&gt;
I started playing with the words and making them resemble singleton. "Complexton"
did not sound right to me. I should mention that I was washing my hands as I was contemplating
this. I lifted up my head, looked into the mirror, and thought, "SIMPLETON." The opposite
of a singleton is a "simpleton." 
&lt;p&gt;
If the opposite of a singleton is not a "simpleton," then what is it? Until I find
a plausible answer, I will try and insert this new term into my next design discussion. &lt;img width="0" height="0" src="http://www.muellerdesigns.net/dasblog/aggbug.ashx?id=2f2caf81-44b8-46e6-8367-97a8ab76cabe" /&gt;</description>
      <comments>http://www.muellerdesigns.net/dasblog/CommentView,guid,2f2caf81-44b8-46e6-8367-97a8ab76cabe.aspx</comments>
      <category>Design</category>
      <category>Technology</category>
    </item>
    <item>
      <trackback:ping>http://www.muellerdesigns.net/dasblog/Trackback.aspx?guid=28b000b4-82d5-41de-8c78-f25d3f46dec4</trackback:ping>
      <pingback:server>http://www.muellerdesigns.net/dasblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.muellerdesigns.net/dasblog/PermaLink,guid,28b000b4-82d5-41de-8c78-f25d3f46dec4.aspx</pingback:target>
      <dc:creator>Alex Mueller</dc:creator>
      <wfw:comment>http://www.muellerdesigns.net/dasblog/CommentView,guid,28b000b4-82d5-41de-8c78-f25d3f46dec4.aspx</wfw:comment>
      <wfw:commentRss>http://www.muellerdesigns.net/dasblog/SyndicationService.asmx/GetEntryCommentsRss?guid=28b000b4-82d5-41de-8c78-f25d3f46dec4</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Duplicate code to me is wrong. Writing duplicate code to me is like using poor grammar.
If I am unaware of it, I am none the wiser. However, if I knowingly use poor grammar
or duplicate code, I feel bad. 
</p>
        <p>
After seeing too many duplications across methods in one or more classes, I decided
to investigate a way to remove these. I am always looking to remove duplicate code,
even code that shares similarities, I look to refator. Removing duplications is important
to adapt more easily to change. When a code change is required, we should only have
to make it in one place. The following article will show two relatively simple means
to address this code smell, delegates and an Aspect-Oriented approach.
</p>
        <p>
The example I am using in this article is seen below. It is a unit test class, StackFixture
class, and it is extremely trivial. This is a typical unit test taken from <a title="Test-Driven Development in Microsoft .NET" href="http://www.amazon.com/Test-Driven-Development-Microsoft-NET-Professional/dp/0735619484/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1207679353&amp;sr=8-1" target="_blank">Test-Driven
Development in Microsoft .NET</a>. I have added the logging functionality as an easy
means to show how these types of DRY violations can occur. While the duplications
in this example deal with logging, they could pertain to other, more complex, functionality
as well. The approaches to removing duplications across methods in this article can
work with these simple scenarios, as well as more complex ones.
</p>
        <p>
Take for example this sample test case. Each test method logs a message before and
after executing the test logic. This violates DRY. We want to keep our test logic
in our method, but factor out the duplicate logging. Again, if we were not logging,
but doing some repetitive logic, we could factor that out as well.
</p>
        <div style="BORDER-RIGHT: gray 1px solid; PADDING-RIGHT: 4px; PADDING-LEFT: 4px; FONT-SIZE: 8pt; BORDER-TOP: gray 1px solid; PADDING-BOTTOM: 4px; MARGIN: 20px 0px 10px; OVERFLOW: auto; BORDER-LEFT: gray 1px solid; WIDTH: 97.5%; CURSOR: text; MAX-HEIGHT: 200px; LINE-HEIGHT: 12pt; PADDING-TOP: 4px; BORDER-BOTTOM: gray 1px solid; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BACKGROUND-COLOR: #f4f4f4">
          <div style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 1:</span> [TestFixture]</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 2:</span>
              <span style="COLOR: #0000ff">public</span>
              <span style="COLOR: #0000ff">class</span> StackFixture
: AbstractBaseFixture</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 3:</span> {</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 4:</span>
              <span style="COLOR: #0000ff">private</span> Stack
stack;</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 5:</span>  </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 6:</span> [SetUp]</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 7:</span>
              <span style="COLOR: #0000ff">public</span>
              <span style="COLOR: #0000ff">void</span> SetUp()</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 8:</span> {</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 9:</span> stack
= <span style="COLOR: #0000ff">new</span> Stack();</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 10:</span> }</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 11:</span>  </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 12:</span> [Test]</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 13:</span>
              <span style="COLOR: #0000ff">public</span>
              <span style="COLOR: #0000ff">void</span> Empty()</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 14:</span> {</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 15:</span> Log.Info(<span style="COLOR: #006080">"Starting
Empty test"</span>);</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 16:</span>
            </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 17:</span> Assert.IsTrue(stack.IsEmpty);</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 18:</span>
            </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 19:</span> Log.Info(<span style="COLOR: #006080">"Ending
Empty test"</span>);</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 20:</span> }</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 21:</span>  </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 22:</span> [Test]</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 23:</span>
              <span style="COLOR: #0000ff">public</span>
              <span style="COLOR: #0000ff">void</span> PushOne()</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 24:</span> {</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 25:</span> Log.Info(<span style="COLOR: #006080">"Starting
PushOne test"</span>);</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 26:</span>  </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 27:</span> stack.Push(<span style="COLOR: #006080">"first
element"</span>);</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 28:</span> Assert.IsFalse(stack.IsEmpty, <span style="COLOR: #006080">"After
Push, IsEmpty should be false."</span>);</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 29:</span>  </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 30:</span> Log.Info(<span style="COLOR: #006080">"Ending
PushOne test"</span>);</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 31:</span> }</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 32:</span>  </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 33:</span> [Test]</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 34:</span>
              <span style="COLOR: #0000ff">public</span>
              <span style="COLOR: #0000ff">void</span> Pop()</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 35:</span> {</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 36:</span> Log.Info(<span style="COLOR: #006080">"Starting
Pop test"</span>);</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 37:</span>  </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 38:</span> stack.Push(<span style="COLOR: #006080">"first
element"</span>);</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 39:</span> stack.Pop();</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 40:</span> Assert.IsTrue(stack.IsEmpty, <span style="COLOR: #006080">"After
Push - Pop, IsEmpty should be true."</span>);</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 41:</span>  </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 42:</span> Log.Info(<span style="COLOR: #006080">"Ending
Pop test"</span>);</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 43:</span> }</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 44:</span>  </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 45:</span> [Test]</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 46:</span> [ExpectedException(<span style="COLOR: #0000ff">typeof</span>(InvalidOperationException))]</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 47:</span>
              <span style="COLOR: #0000ff">public</span>
              <span style="COLOR: #0000ff">void</span> PopEmptyStack()</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 48:</span> {</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 49:</span> Log.Info(<span style="COLOR: #006080">"Starting
PopEmptyStack test"</span>);</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 50:</span>  </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 51:</span> stack.Pop();</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 52:</span>  </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 53:</span> Log.Info(<span style="COLOR: #006080">"Ending
PopEmptyStack test"</span>);</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 54:</span> }</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 55:</span> }</pre>
          </div>
        </div>
        <p>
 
</p>
        <p>
          <strong>Remove Duplications with Delegates</strong>
        </p>
        <p>
Quite simply, we can remove our method duplications using a delegate, in this case,
the <a title="System.Action delegate" href="http://msdn2.microsoft.com/en-us/library/system.action.aspx" target="_blank">System.Action
delegate</a>. Thanks to <a title="Ayende" href="http://www.ayende.com/" target="_blank">Ayende</a> for
helping me understand this option. We create a method, TestMethod (as shown below),
and add it to our StackFixture class. The method takes two strings (string beforeMessage
and string afterMessage) and the Action delegate, representing the test method logic.
We will call this method within our test cases.
</p>
        <div style="BORDER-RIGHT: gray 1px solid; PADDING-RIGHT: 4px; PADDING-LEFT: 4px; FONT-SIZE: 8pt; BORDER-TOP: gray 1px solid; PADDING-BOTTOM: 4px; MARGIN: 20px 0px 10px; OVERFLOW: auto; BORDER-LEFT: gray 1px solid; WIDTH: 97.5%; CURSOR: text; MAX-HEIGHT: 200px; LINE-HEIGHT: 12pt; PADDING-TOP: 4px; BORDER-BOTTOM: gray 1px solid; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BACKGROUND-COLOR: #f4f4f4">
          <div style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 1:</span>
              <span style="COLOR: #0000ff">public</span>
              <span style="COLOR: #0000ff">void</span> TestMethod(<span style="COLOR: #0000ff">string</span> beforeMessage, <span style="COLOR: #0000ff">string</span> afterMessage,
Action action)</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 2:</span> {</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 3:</span>
              <span style="COLOR: #008000">//
before</span>
            </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 4:</span> Log.Info(beforeMessage);</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 5:</span>
            </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 6:</span>
              <span style="COLOR: #008000">//
invoke our method</span>
            </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 7:</span> action();</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 8:</span>
            </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 9:</span>
              <span style="COLOR: #008000">//
after</span>
            </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 10:</span> Log.Info(afterMessage);</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 11:</span> }</pre>
          </div>
        </div>
        <p>
Then, in our tests, we replace the following test method...
</p>
        <div style="BORDER-RIGHT: gray 1px solid; PADDING-RIGHT: 4px; PADDING-LEFT: 4px; FONT-SIZE: 8pt; BORDER-TOP: gray 1px solid; PADDING-BOTTOM: 4px; MARGIN: 20px 0px 10px; OVERFLOW: auto; BORDER-LEFT: gray 1px solid; WIDTH: 97.5%; CURSOR: text; MAX-HEIGHT: 200px; LINE-HEIGHT: 12pt; PADDING-TOP: 4px; BORDER-BOTTOM: gray 1px solid; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BACKGROUND-COLOR: #f4f4f4">
          <div style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 1:</span> [Test]</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 2:</span>
              <span style="COLOR: #0000ff">public</span>
              <span style="COLOR: #0000ff">void</span> Pop()</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 3:</span> {</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 4:</span> Log.Info(<span style="COLOR: #006080">"Starting
Pop test"</span>);</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 5:</span>  </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 6:</span> stack.Push(<span style="COLOR: #006080">"first
element"</span>);</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 7:</span> stack.Pop();</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 8:</span> Assert.IsTrue(stack.IsEmpty, <span style="COLOR: #006080">"After
Push - Pop, IsEmpty should be true."</span>);</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 9:</span>  </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 10:</span> Log.Info(<span style="COLOR: #006080">"Ending
Pop test"</span>);</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 11:</span> }</pre>
          </div>
        </div>
        <p>
With the same method using our delegate approach.
</p>
        <div style="BORDER-RIGHT: gray 1px solid; PADDING-RIGHT: 4px; PADDING-LEFT: 4px; FONT-SIZE: 8pt; BORDER-TOP: gray 1px solid; PADDING-BOTTOM: 4px; MARGIN: 20px 0px 10px; OVERFLOW: auto; BORDER-LEFT: gray 1px solid; WIDTH: 97.5%; CURSOR: text; MAX-HEIGHT: 200px; LINE-HEIGHT: 12pt; PADDING-TOP: 4px; BORDER-BOTTOM: gray 1px solid; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BACKGROUND-COLOR: #f4f4f4">
          <div style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 1:</span> [Test]</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 2:</span>
              <span style="COLOR: #0000ff">public</span>
              <span style="COLOR: #0000ff">void</span> Pop()</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 3:</span> {</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 4:</span> TestMethod(<span style="COLOR: #006080">"Starting
Pop test"</span>, <span style="COLOR: #006080">"Ending Pop test"</span>,</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 5:</span>
              <span style="COLOR: #0000ff">delegate</span>
            </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 6:</span> {</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 7:</span> stack.Push(<span style="COLOR: #006080">"first
element"</span>);</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 8:</span> stack.Pop();</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 9:</span> Assert.IsTrue(stack.IsEmpty, <span style="COLOR: #006080">"After
Push - Pop, IsEmpty should be true."</span>);</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 10:</span> });</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 11:</span> }</pre>
          </div>
        </div>
        <p>
We can replace each of our test methods with the same TestMethod using the <a title="System.Action delegate" href="http://msdn2.microsoft.com/en-us/library/system.action.aspx" target="_blank">System.Action
delegate</a>. It will then easy to omit our before and after strings replacing them
with "action.Method.Name," or some other intelligent logic to determine what to log.
</p>
        <p>
This approach works well, but delegates are often difficult to understand. If this
solution suits your needs, make sure the implementation is easily maintainable. What
is nice about this approach is how simple it is. There is no need to reference any
assemblies outside of the .Net framework, i.e. no third party dependencies.
</p>
        <p>
 
</p>
        <p>
          <strong>The Aspect-Oriented Approach</strong>
        </p>
        <p>
          <a title="Aspect-Oriented Programming" href="http://en.wikipedia.org/wiki/Aspect-oriented_programming" target="_blank">Aspect-Oriented
Programming</a> (AOP) is an entirely different animal. It certainly deserves more
than just a blog post. Please read more about it online. This article will not explain
the details of AOP.
</p>
        <p>
If you are reading this, welcome back. I will assume you are now familiar with AOP.
There are several options for AOP frameworks. Some frameworks I have used are <a title="Spring.net" href="http://www.springframework.net/" target="_blank">Spring.net</a>, <a title="Castle Project" href="http://www.castleproject.org/" target="_blank">Castle
Project</a>, and <a title="PostSharp" href="http://www.postsharp.org/" target="_blank">PostSharp</a>.
The former two provide IoC capabilities as well. I suggest using a well-supported
framework, one with community support and frequent updates. Investigate for yourself,
there are several nice options available.
</p>
        <p>
 
</p>
        <p>
          <strong>AOP with Castle DynamicProxy</strong>
        </p>
        <p>
          <a title="Hamilton Verissimo" href="http://hammett.castleproject.org/" target="_blank">Hamilton
Verissimo</a> put together a good <a title="sample using Castle's DynamicProxy" href="http://www.codeproject.com/KB/cs/hamiltondynamicproxy.aspx" target="_blank">sample
using Castle's DynamicProxy</a>. It is a nice, clean implementation.This worked fine
for me and would work well in other situations. However, in my scenario, if I were
to use this approach, I needed to have each of my test classes extend from MarshalByRef.
In addition, I would need to modify the underlying NUnit framework to create my proxies
in order to provide advice. Since I could not do the latter, or did not want to investigate,
I searched for other AOP options.
</p>
        <p>
The DynamicProxy aproach to solving your AOP needs is a great option. It just did
not work in my situation, only because NUnit executes each of my methods. I would
need to somehow intercept the creation of my test class, create a proxy of it, and
execute the test methods on it.
</p>
        <p>
 
</p>
        <p>
          <strong>AOP with PostSharp</strong>
        </p>
        <p>
          <a title="Gael Fraiteur's PostSharp" href="http://www.postsharp.org" target="_blank">Gael
Fraiteur's PostSharp</a> is a great option for AOP needs. It is extremely clean and
easy to use. It is the simplest AOP framework I have used. I suggest watching Gael's <a title="video tutorial" href="http://www.postsharp.org/about/video/" target="_blank">video
tutorial</a>.
</p>
        <p>
The first thing I needed to do, besides downloading and installing PostSharp, is to
add two references to my project, PostSharp.Laos and PostSharp.Public. After that,
I create a simple class extending OnMethodInvocationAspect, called LoggingMethodInvocationAspect. 
</p>
        <div style="BORDER-RIGHT: gray 1px solid; PADDING-RIGHT: 4px; PADDING-LEFT: 4px; FONT-SIZE: 8pt; BORDER-TOP: gray 1px solid; PADDING-BOTTOM: 4px; MARGIN: 20px 0px 10px; OVERFLOW: auto; BORDER-LEFT: gray 1px solid; WIDTH: 97.5%; CURSOR: text; MAX-HEIGHT: 200px; LINE-HEIGHT: 12pt; PADDING-TOP: 4px; BORDER-BOTTOM: gray 1px solid; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BACKGROUND-COLOR: #f4f4f4">
          <div style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 1:</span> [Serializable]</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 2:</span>
              <span style="COLOR: #0000ff">public</span>
              <span style="COLOR: #0000ff">sealed</span>
              <span style="COLOR: #0000ff">class</span> LoggingMethodInvocationAspect
: OnMethodInvocationAspect</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 3:</span> {</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 4:</span>
              <span style="COLOR: #0000ff">private</span> ILogger
log;</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 5:</span>  </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 6:</span>
              <span style="COLOR: #0000ff">public</span> LoggingMethodInvocationAspect(ILogger
logger)</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 7:</span> {</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 8:</span> log
= logger;</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 9:</span> {</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 10:</span>  </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 11:</span>
              <span style="COLOR: #0000ff">public</span>
              <span style="COLOR: #0000ff">override</span>
              <span style="COLOR: #0000ff">void</span> OnInvocation(MethodInvocationEventArgs
eventArgs)</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 12:</span> {</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 13:</span>
              <span style="COLOR: #008000">//
before</span>
            </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 14:</span> log.Info(<span style="COLOR: #006080">"OnInvocation
Before proceed"</span>);</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 15:</span>  </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 16:</span>
              <span style="COLOR: #008000">//
invoke</span>
            </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 17:</span> eventArgs.Proceed();</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 18:</span>  </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 19:</span>
              <span style="COLOR: #008000">//
after</span>
            </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 20:</span> log.Info(<span style="COLOR: #006080">"OnInvocation
After proceed"</span>);</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 21:</span> }</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 22:</span> }</pre>
          </div>
        </div>
        <p>
At this point, all we need to do is apply our aspect on target methods. The "AttributeTargetMembers"
attribute can use wildcards. This tells the AOP framework to only intercept those
methods in the "MathService" class that start with "Test." Below is the sample where
I specify the target assembly, target type (class or classes to intercept), and target
methods to intercept. There are many features beyond what I am showing so do further
investigation.
</p>
        <div style="BORDER-RIGHT: gray 1px solid; PADDING-RIGHT: 4px; PADDING-LEFT: 4px; FONT-SIZE: 8pt; BORDER-TOP: gray 1px solid; PADDING-BOTTOM: 4px; MARGIN: 20px 0px 10px; OVERFLOW: auto; BORDER-LEFT: gray 1px solid; WIDTH: 97.5%; CURSOR: text; MAX-HEIGHT: 200px; LINE-HEIGHT: 12pt; PADDING-TOP: 4px; BORDER-BOTTOM: gray 1px solid; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BACKGROUND-COLOR: #f4f4f4">
          <div style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 1:</span> [assembly:
ClassLibrary.SampleInterfaces.LoggingMethodInvocationAspect(</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 2:</span> AttributeTargetAssemblies
= <span style="COLOR: #006080">"ClassLibrary.UnitTesting.Sandbox"</span>,</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 3:</span> AttributeTargetTypes
= <span style="COLOR: #006080">"ClassLibrary.UnitTesting.Sandbox.MathService"</span>, </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 4:</span> AttributeTargetMembers
= <span style="COLOR: #006080">"Test*"</span>)]</pre>
          </div>
        </div>
        <p>
Finally, my StackFixture class now looks something like this. Notice that the duplicate
logging logic is now removed and each test method is prefixed with "Test" in the method
name. This is so that PostSharp can filter what methods to intercept.
</p>
        <div style="BORDER-RIGHT: gray 1px solid; PADDING-RIGHT: 4px; PADDING-LEFT: 4px; FONT-SIZE: 8pt; BORDER-TOP: gray 1px solid; PADDING-BOTTOM: 4px; MARGIN: 20px 0px 10px; OVERFLOW: auto; BORDER-LEFT: gray 1px solid; WIDTH: 97.5%; CURSOR: text; MAX-HEIGHT: 200px; LINE-HEIGHT: 12pt; PADDING-TOP: 4px; BORDER-BOTTOM: gray 1px solid; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BACKGROUND-COLOR: #f4f4f4">
          <div style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 1:</span> [assembly:
ClassLibrary.SampleInterfaces.LoggingMethodInvocationAspect(</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 2:</span> AttributeTargetAssemblies
= <span style="COLOR: #006080">"ClassLibrary.UnitTesting.Sandbox"</span>,</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 3:</span> AttributeTargetTypes
= <span style="COLOR: #006080">"ClassLibrary.UnitTesting.Sandbox.MathService"</span>, </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 4:</span> AttributeTargetMembers
= <span style="COLOR: #006080">"Test*"</span>)]</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 5:</span>
            </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 6:</span> [TestFixture]</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 7:</span>
              <span style="COLOR: #0000ff">public</span>
              <span style="COLOR: #0000ff">class</span> StackFixture</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 8:</span> {</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 9:</span>
              <span style="COLOR: #0000ff">private</span> Stack
stack;</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 10:</span>  </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 11:</span> [SetUp]</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 12:</span>
              <span style="COLOR: #0000ff">public</span>
              <span style="COLOR: #0000ff">void</span> SetUp()</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 13:</span> {</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 14:</span> stack
= <span style="COLOR: #0000ff">new</span> Stack();</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 15:</span> }</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 16:</span>  </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 17:</span> [TearDown]</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 18:</span>
              <span style="COLOR: #0000ff">public</span>
              <span style="COLOR: #0000ff">void</span> TearDown(){}</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 19:</span>  </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 20:</span> [Test]</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 21:</span>
              <span style="COLOR: #0000ff">public</span>
              <span style="COLOR: #0000ff">void</span> TestEmpty()</pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <span style="COLOR: #606060"> 22:</span> { </pre>
            <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMI