<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://devlicio.us/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Derik Whittaker : TDD, Development</title><link>http://devlicio.us/blogs/derik_whittaker/archive/tags/TDD/Development/default.aspx</link><description>Tags: TDD, Development</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP1 (Build: 31106.3070)</generator><item><title>Talking Mocks at TriNug, what a great time, what a great group</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2008/11/13/talking-mocks-at-trinug-what-a-great-time-what-a-great-group.aspx</link><pubDate>Thu, 13 Nov 2008 12:36:01 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:43022</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=43022</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=43022</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2008/11/13/talking-mocks-at-trinug-what-a-great-time-what-a-great-group.aspx#comments</comments><description>&lt;p&gt;Last night I had the opportunity to&amp;nbsp;do my &amp;#39;Taking your tests to the next level with Mocks&amp;#39;&amp;nbsp;session&amp;nbsp;to the &lt;a href="http://trinug.org/"&gt;TriNug&lt;/a&gt; user group.&amp;nbsp; I would first like to say thanks to Doug Wilson and his entire group.&amp;nbsp; They had a great turn out (45ish people) and they asked a ton of great questions.&lt;/p&gt; &lt;p&gt;To kick off the session I ask the same question I ask everything I give this session &amp;#39;Who in here writes tests as part of their development routine?&amp;#39;.&amp;nbsp; The response I got did not surprise me, about 30% said they did.&amp;nbsp; I then asked those 30%, who using a mocking framework?&amp;nbsp; Again the response did not surprise me, only about 50%.&lt;/p&gt; &lt;p&gt;Of course with only 30% even saying they test, I had to ask why, why and why.&amp;nbsp; The responses I got I have heard before and thought I would share them&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;strong&gt;It is too hard to get started&lt;br /&gt;&lt;/strong&gt;I have heard this one before, and I am not going to lie to you, writing tests is hard, it takes effort and time to learn how to do it.&amp;nbsp; But just ask yourself this.&amp;nbsp; When learning anything new is it easy?&amp;nbsp; Are you able to just pickup a new tool/technology and &amp;#39;know it&amp;#39; or do you have to learn it?&amp;nbsp; My guess you have to learn it, testing/mocking is no different.&lt;br /&gt;&lt;/li&gt; &lt;li&gt;&lt;strong&gt;My client/company is not paying me to write tests&lt;br /&gt;&lt;/strong&gt;Sorry, but this is one statement have to call BS on.&amp;nbsp; I immediately asked, is your company paying you to write shitty quality?&amp;nbsp; Or are they paying you to produce quality code?&amp;nbsp; If they are paying you to write shitty code, &lt;font color="#ff0000"&gt;STOP&lt;/font&gt; reading now as I am done talking to you (ok, may be not, but really??? shitty code is what they want???).&amp;nbsp; If they are paying you to create quality code how can you insure it without tests?&amp;nbsp; My guess is that you have tests, but they just happen to be of the manual, error prone nature.&lt;br /&gt;&lt;/li&gt; &lt;li&gt;&lt;strong&gt;I do not have time&lt;br /&gt;&lt;/strong&gt;Again, another one I call BS on.&amp;nbsp; I followed this up with &amp;#39;let me guess, you have time to debug/bug hunt at the end right?&amp;#39;.&amp;nbsp; The key to testing is that it does take time (wow, that is honest) but it is either a pay me now, or pay me later scenario.&amp;nbsp; Either you take the time now to embed quality or you take the time later to duck-tap quality.&amp;nbsp; Your choice?&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;With this information in hand, I really attempted to drive home the values of both testing as well as using a mocking framework to remove dependencies.&amp;nbsp; I think towards the end of the night I had converted some people to &amp;#39;believers&amp;#39; and hopefully they will either give testing a solid go (assuming they are not testing right now) or give using a mocking framework a go.&lt;/p&gt; &lt;p&gt;You can get any of my session information from Google code&amp;nbsp;from this location&amp;nbsp;&lt;a title="http://code.google.com/p/graudo/" href="http://code.google.com/p/graudo/"&gt;http://code.google.com/p/graudo/&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;Till next time,&lt;/p&gt; &lt;p&gt;&lt;font color="#808080"&gt;&lt;strong&gt;[----- Remember to check out &lt;/strong&gt;&lt;strong&gt;&lt;a href="http://www.dimecasts.net"&gt;DimeCasts.Net&lt;/a&gt;&lt;/strong&gt;&lt;strong&gt; -----]&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=43022" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/TDD/default.aspx">TDD</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Rhino+Mocks/default.aspx">Rhino Mocks</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Presentations/default.aspx">Presentations</category></item><item><title>Testing your IoC Bindings</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2008/09/10/testing-your-ioc-bindings.aspx</link><pubDate>Wed, 10 Sep 2008 11:53:55 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:42272</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=42272</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=42272</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2008/09/10/testing-your-ioc-bindings.aspx#comments</comments><description>&lt;p&gt;One thing I like to do when I am using a IoC (Inversion of Control) container is to create simple test that ensure that my objects have been wired up correctly and can be created via the IoC container.&amp;nbsp; &lt;/p&gt; &lt;p&gt;I know this may seem like overkill, but I feel that by having my IoC bindings covered by tests I am covering all my bases.&lt;/p&gt; &lt;p&gt;So, what does testing my bindings do for me&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;strong&gt;Allows me to know if my object is configured correctly&lt;/strong&gt;&lt;br /&gt;By having these tests I will know immediately if I have somehow broken my IoC bindings glue (yes, glue is the technical term in this case).&amp;nbsp; &lt;br /&gt;&lt;br /&gt;It is not hard to phantom that when making changes to your IoC bindings logic (either via config files or via inline code) you can mistakenly break something.&amp;nbsp; Having these tests provides me immediate feedback if this were to happen.&lt;br /&gt; &lt;li&gt;&lt;strong&gt;Allows me to know if my objects dependencies are configured correctly&lt;br /&gt;&lt;/strong&gt;Setting up the wiring for your main object is only half the battle.&amp;nbsp; When using an IoC container many time you are going to have that container do some sort of Constructor Injection of your dependencies.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;By having tests that simply create my object with IoC I will find out immediately if one of my dependency objects is not wired up.&amp;nbsp; This scenario is pretty common and having this test can save you some headaches.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Here is the test code I use for my IoC bindings tests:&lt;/p&gt; &lt;p&gt;[Test]&lt;br /&gt;public void CanCreateViaDI()&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var iocObject = ObjectFactory.GetInstance&amp;lt; YourObjectHere &amp;gt;(); &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Assert.That( iocObject, Is.Not.Null );  &lt;p&gt;} &lt;p&gt;Hope this helps someone. &lt;p&gt;Till next time, &lt;p&gt;&lt;font color="#808080"&gt;&lt;strong&gt;[----- Remember to check out &lt;/strong&gt;&lt;strong&gt;&lt;a href="http://www.dimecasts.net"&gt;DimeCasts.Net&lt;/a&gt;&lt;/strong&gt;&lt;strong&gt; -----]&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=42272" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/TDD/default.aspx">TDD</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Best+Practice/default.aspx">Best Practice</category></item><item><title>RhinoMocks new Arrange, Act, Assert does not seem to work under MSTest....odd</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2008/07/23/rhinomocks-new-arrange-act-assert-does-not-seem-to-work-under-mstest-odd.aspx</link><pubDate>Wed, 23 Jul 2008 15:38:39 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:41411</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=41411</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=41411</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2008/07/23/rhinomocks-new-arrange-act-assert-does-not-seem-to-work-under-mstest-odd.aspx#comments</comments><description>&lt;p&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;-- UPDATE See text in red below&amp;nbsp;--&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Ok, I am in NO way trying to say that this is either Rhino&amp;#39;s issue or MSTest.&amp;nbsp; I am simply blogging this with the intent that someone can shed some insight as to what may be going on.&amp;nbsp; Although, since I know that the AAA logic of Rhino works with the EXACT same code under NUnit i have to believe it has something to do with the MSTest works.&lt;/p&gt; &lt;p&gt;So here is my propblem:&lt;/p&gt; &lt;p&gt;I have a test where i want to mock out and set an expectation on a repository.&amp;nbsp; When I tried the code via the AAA syntax my expectation would only return a null.&amp;nbsp; When I changed to use Record/Playback everything worked well.&amp;nbsp; Odd.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Here is the syntax for AAA (non-working)&lt;/strong&gt;&lt;/p&gt;&lt;pre class="c-sharp" name="code"&gt;var mockRepository = new MockRepository();
var mockStatusCheckRepository = mockRepository.DynamicMock();

mockStatusCheckRepository.Expect( x =&amp;gt; x.GetCustomerAuditInformation( &amp;quot;&amp;quot;, &amp;quot;&amp;quot; ) ).IgnoreArguments().Return( new CustomerAuditInformation { NeedsInitialDataCreated = true } ).Repeat.Once();
var information = mockStatusCheckRepository.GetCustomerAuditInformation( &amp;quot;&amp;quot;, &amp;quot;&amp;quot; );
// Returns null
&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;I was able to get this working by NOT using the instance of MockRepoistory, instead using the Static Methods.&amp;nbsp; Belows Code works&lt;/font&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/p&gt;&lt;pre class="c-sharp" name="code"&gt;
var mockStatusCheckRepository = MockRepository.GenerateMock();

mockStatusCheckRepository.Expect( x =&amp;gt; x.GetCustomerAuditInformation( &amp;quot;&amp;quot;, &amp;quot;&amp;quot; ) ).IgnoreArguments().Return( new CustomerAuditInformation { NeedsInitialDataCreated = true } ).Repeat.Once();

var information = mockStatusCheckRepository.GetCustomerAuditInformation( &amp;quot;&amp;quot;, &amp;quot;&amp;quot; )
&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;So, this may just be a case of me not fully understanding the new AAA syntax and how to use it, but I know that using the instance stuff works under NUnit... odd&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;br /&gt;Here is the syntax for the Record/Playback (working) &lt;font color="#ff0000"&gt;- Can use the AAA syntax above as well&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;pre class="c-sharp" name="code"&gt;var mockRepository = new MockRepository();
var mockStatusCheckRepository = mockRepository.DynamicMock();

using ( mockRepository.Record() )
{
    mockStatusCheckRepository.Expect( x =&amp;gt; x.GetCustomerAuditInformation( &amp;quot;&amp;quot;, &amp;quot;&amp;quot; ) ).IgnoreArguments().Return( new CustomerAuditInformation { NeedsInitialDataCreated = true } ).Repeat.Once();

}

using ( mockRepository.Playback() )
{
    var information = mockStatusCheckRepository.GetCustomerAuditInformation( &amp;quot;&amp;quot;, &amp;quot;&amp;quot; );
}
&lt;/pre&gt;
&lt;p&gt;Cany anyone shed some light on this?&amp;nbsp; Is there a way around this?&lt;/p&gt;
&lt;p&gt;Till next time,&lt;/p&gt;
&lt;p&gt;&lt;font color="#808080"&gt;&lt;strong&gt;[----- Remember to check out &lt;/strong&gt;&lt;strong&gt;&lt;a href="http://www.dimecasts.net"&gt;DimeCasts.Net&lt;/a&gt;&lt;/strong&gt;&lt;strong&gt; -----]&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=41411" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/TDD/default.aspx">TDD</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Rhino+Mocks/default.aspx">Rhino Mocks</category></item><item><title>Thoughts on Testing an API</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2008/04/14/thoughts-on-testing-the-api-you-are-creating.aspx</link><pubDate>Mon, 14 Apr 2008 12:32:22 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:40061</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=40061</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=40061</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2008/04/14/thoughts-on-testing-the-api-you-are-creating.aspx#comments</comments><description>&lt;p&gt;Over the past few weeks I have worked on a few products for my client that will be used as API&amp;#39;s.&amp;#160; These API&amp;#39;s will be used by either their own (external) clients or other internal departments.&amp;#160; Working on these projects made me think about testing in a little different light compared to normal&amp;#160; testing.&amp;#160; I thought I would share some of my thoughts and experiences that I have learned while developing and testing API style applications.&lt;/p&gt;  &lt;p&gt;First thing to keep in mind is that testing an API is not a whole lot different then testing a product (non-API), but you do need to take a few extra steps to ensure that your code is well tested and can be easily consumed.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Find the &amp;#39;Main Artery&amp;#39; in your code.     &lt;br /&gt;&lt;/strong&gt;This may seem pretty straight forward, but finding this Main Artery is critical on your journey to testing your API.&amp;#160; Unlink many &amp;#39;standard&amp;#39; applications which have many entry points and exit points, API&amp;#39;s tend to have a very few entry/exit points.&amp;#160; This means that many of the features of the API may flow down the same artery, which provided you a huge area of risk.&lt;/p&gt;  &lt;p&gt;Finding this pathway is also critical due to the fact that the majority of your Use Cases are likely to travel down at least part of this path and if there is any type of issues with either your code or your logic, they will crop up all over the place.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Here is a little example     &lt;br /&gt;&lt;/em&gt;Imagine you have a 2 story house, and you want to go from the garage to the second floor.&amp;#160; When you enter the house via the garage door there are likely a few different ways to move around the first floor until you get to the stair well.&amp;#160; However, once you reach the stairs, there is only one way to get to the second floor.&amp;#160; The stair well in this example is our main artery.&amp;#160; If anything goes wrong with the stairs we cannot go from the first floor to the second.&amp;#160; Hence the need to find and test this code as heavily as possible.    &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Create as many &amp;#39;Scenario&amp;#39; style Integration Tests as you can.     &lt;br /&gt;&lt;/strong&gt;The best way to test your API is to not only create a solid set of &lt;a href="http://en.wikipedia.org/wiki/Unit_test"&gt;Unit Tests&lt;/a&gt; that allow you to test your individual modules, but you also need to have a very exhaustive set of &lt;a href="http://en.wikipedia.org/wiki/Integration_testing"&gt;Integration Tests&lt;/a&gt; that allow you to run end to end slices through your API.&amp;#160; &lt;/p&gt;  &lt;p&gt;You want to make sure that your API functions from the outside-in as desired.&amp;#160; The worst thing you can do is hand over your API and have someone else find an simple issue.&amp;#160; This type of testing will also allow you to test the performance of your API, if performance is something that you may be concerned with.&lt;/p&gt;  &lt;p&gt;When creating your Scenario tests you will not only want to test known good data and known bad data, but also test with various random data.&amp;#160; Your goal should be to try to make your application fail, and in a bad way.&amp;#160; Creating tests for &amp;#39;known&amp;#39; conditions is fine, but they will not ensure success.&amp;#160; Try to find edge cases and test as many of those as well.   &lt;br /&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Create a &amp;#39;Test Application&amp;#39; that consumes your API as your expected consumers would.     &lt;br /&gt;&lt;/strong&gt;Because your API is going to be consumed via 3rd party you should create some sort of stand alone test application for verify your API.&amp;#160; I would suggest you create a new .Net solution and add 1 project to the solution, with this project being nothing more then a test project&amp;#160; *** I AM NOT SAYING TO CREATE A UI APPLICATION ***.&amp;#160; By creating the stand alone solution you will learn how much effort or pain will be involved in consuming your API.&amp;#160; There are a few things in particular that you should look our for when consuming your API&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Are they any configuration files that I need to deploy?&lt;/li&gt;    &lt;li&gt;Are my entry points for the API clearly defined?&lt;/li&gt;    &lt;li&gt;Do I need the consumer to reference any other assemblies besides my own?&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;You may find that your configuration setup is flawed, or you may find that you made too many assumptions about consumption during your initial development.&amp;#160; I know that when I did this I was enlightened to how my API was going to be used, and allowed me to better understand how to develop future features.&lt;/p&gt;  &lt;p&gt;Finally, by consuming your own API you have a better understanding of how it works and this will allow you to create some sort of documentation on consumption of your API that can be attached to your code.&amp;#160; This can be huge asset to the API and can lessen the learning curve for your consumers.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The above thoughts/comments are purely created out of my own experiences, actual results may vary.&lt;/p&gt;  &lt;p&gt;Till next time,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=40061" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Agile/default.aspx">Agile</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/.Net/default.aspx">.Net</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/TDD/default.aspx">TDD</category></item><item><title>App.Config issues when running NUnit via Resharper</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2008/03/25/app-config-issues-when-running-nunit-via-resharper.aspx</link><pubDate>Tue, 25 Mar 2008 13:43:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:39782</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=39782</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=39782</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2008/03/25/app-config-issues-when-running-nunit-via-resharper.aspx#comments</comments><description>&lt;p&gt;***** Update *****&lt;br /&gt;This issue is directly related to a #R 4 EAP issue.&amp;nbsp; I was using build 755 and this was an issue.&amp;nbsp; As of build 762, this is no longer an issue.&lt;br /&gt;********************&lt;br /&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Today I encountered some odd behavior when trying to run some tests against my configuration object.&amp;nbsp; I am hoping that someone out there has some insight for me.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;My issue&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;I have a project that produces an assembly by the name of &lt;i&gt;AccessKey.Domain.Tests.dll&lt;/i&gt;.&amp;nbsp; Because I have a app.config file in the project, the config file is renamed to AccessKey.Domain.Tests.dll.config when the project is compiled.&lt;/p&gt;  &lt;p&gt;The problem is that when I try to access the appSettings value in the config file I am only getting nulls.&amp;nbsp; For what ever reason, the .net framework thinks my file should be named AccessKey.Domain.Tests.config (notice the .dll is missing from the name).&lt;/p&gt;  &lt;p&gt;I have verified that the framework is in fact trying to pick up the wrong assembly by checking 2 things.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;System.AppDomain.CurrentDomain.SetupInformation.ConfigurationFile&lt;/li&gt;    &lt;li&gt;ConfigurationManager.OpenExeConfiguration( ConfigurationUserLevel.None ).FilePath&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Both of these have point to using the wrong config file name.&amp;nbsp; I even tried to set the value in the System.AppDomain.CurrentDomain.SetupInformation.ConfigurationFile property, but that did not work.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;My Resolution (but is lame)&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;In order to get this to work, I simply created a config file in my test project named AccessKey.Domain.Tests.config (again, notice the .dll is missing) and set the file to be copied to the output directory at compile time. &lt;/p&gt;  &lt;p&gt;I don&amp;#39;t like doing this as it feels dirty as well as it is not testing my system correctly.&lt;/p&gt;  &lt;p&gt;&amp;nbsp;&lt;/p&gt;  &lt;p&gt;Does anyone have a solution for my problem.&amp;nbsp; In my 2+ years of testing, I have NEVER run into this issue....... HELP!&lt;/p&gt;  &lt;p&gt;Till next time,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=39782" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Agile/default.aspx">Agile</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/TDD/default.aspx">TDD</category></item><item><title>Backing in Unit Tests into an existing project</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/10/09/backing-in-unit-tests-into-an-existing-project.aspx</link><pubDate>Tue, 09 Oct 2007 12:35:39 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:38646</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=38646</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=38646</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/10/09/backing-in-unit-tests-into-an-existing-project.aspx#comments</comments><description>&lt;p&gt;Recently I was asked about backing in unit tests into an existing project.&amp;nbsp; In particular I was asked&amp;nbsp;A) was possible and B) is it worth it.&amp;nbsp; In short my answers to both these are Yes and Yes.&amp;nbsp; However, backing in unit tests is not without its challenges.&amp;nbsp; I thought today I would go express my experiences with doing exactly this and what types of hurdles I ran into.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Start off by only testing new code&lt;br /&gt;&lt;/strong&gt;When backing in tests, it is very important to accept the fact that a large percentage of your application is going to be untested.&amp;nbsp; Accepting this fact will help you move forward.&amp;nbsp; I would suggest that as you write new code (be it new modules, features or&amp;nbsp;whatever) you write them following the TDD practice.&amp;nbsp; This will be the simplest way to get the ball rolling.&amp;nbsp; &lt;/p&gt; &lt;p&gt;Doing this is also an easy way to get other team members on board with the testing idea.&amp;nbsp; I know from personal experience that when we wanted to started following TDD on a project that was 2 years in, many of the other developers thought it was a waste because we have so much that is untested.&amp;nbsp; They thought it would take too much time/effort to write test for existing code.&amp;nbsp; I agree with this.&amp;nbsp; So only test going forward&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Add tests to existing code only when changes are needed&lt;br /&gt;&lt;/strong&gt;I know I just said above to only test new code, and this is true.&amp;nbsp; However, when you are making changes to existing code test those changes.&amp;nbsp; Again, you don&amp;#39;t have to try to test all the existing code, only the path ways you are adding/changing.&amp;nbsp; &lt;/p&gt; &lt;p&gt;If you follow this, over time you will start to build a nice suite of tests that tests not only new code, but some existing code as well.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Mock as much as possible&lt;br /&gt;&lt;/strong&gt;Mocking is a great tool.&amp;nbsp; I like to mock code that I don&amp;#39;t have control over, or when I have no faith the code will work reliably.&amp;nbsp; This is especially&amp;nbsp;important&amp;nbsp;in a project that does not have tests.&amp;nbsp; &lt;/p&gt; &lt;p&gt;An example would be this.&amp;nbsp; Lets say you&amp;nbsp;are&amp;nbsp;adding a new feature to an application that needs to call into some sort of calculation engine.&amp;nbsp; Since this calculation engine is not tested and you have no real faith that it will work&amp;nbsp;reliably,&amp;nbsp;mock it.&amp;nbsp; &amp;nbsp;You should know that given a valid set of inputs you expect to receive a given response.&amp;nbsp; By mocking this you remove all risk of the calculation engine failing thus causing your tests to fail.&amp;nbsp; &lt;/p&gt; &lt;p&gt;*** I can hear you now,&amp;nbsp;you want&amp;nbsp;your test to fail when the calculation engine fails.... No you don&amp;#39;t.&amp;nbsp; Unless your test is actually testing the calculation engine, you don&amp;#39;t care if it passes or fails.&amp;nbsp; You just need to call it. ***&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Take this as a learning experience&lt;br /&gt;&lt;/strong&gt;Take this time as a way to learn to write good solid tests.&amp;nbsp; This will be of great benefit later in your next project.&amp;nbsp; Also, you will also learn how to write better code that is more acceptable to testing (hum... sounds like another good post).&amp;nbsp; Remember, in order to become good at something you must first be bad at it.&amp;nbsp; But with practice you will become better and you will be a better developer because of it.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Be patient&lt;br /&gt;&lt;/strong&gt;Testing is painful at first.&amp;nbsp; It is a shift in your development mind set.&amp;nbsp; Be patient, it gets better.&amp;nbsp; This is no different then learning anything else.&amp;nbsp; It will take time, but eventually you will become comfortable with TDD and it will become second nature.&amp;nbsp; You never know, you may end up like me and find it odd when you are NOT writing tests.&lt;/p&gt; &lt;p&gt;I hope this helps.&lt;/p&gt; &lt;p&gt;Till next time,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=38646" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Agile/default.aspx">Agile</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Methodology/default.aspx">Methodology</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/TDD/default.aspx">TDD</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Opinion/default.aspx">Opinion</category></item><item><title>Why I believe IN and WRITE unit tests</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/10/01/why-i-believe-in-and-write-unit-tests.aspx</link><pubDate>Tue, 02 Oct 2007 00:27:25 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:38554</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>12</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=38554</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=38554</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/10/01/why-i-believe-in-and-write-unit-tests.aspx#comments</comments><description>&lt;p&gt;In my last post I think I struck a cord with some people in my post &amp;#39;Unit tests taking too much time&amp;#39;.&amp;nbsp; My intent was NOT to sound like an elitist Agilist or any else of that nature.&amp;nbsp; My intent was simply to put a post out there about the misperception (in my opinion) about how writing unit tests take too much time.&lt;/p&gt; &lt;p&gt;I thought I would put my &amp;#39;retort&amp;#39; on why I believe in&amp;nbsp;and write unit tests.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Allows&amp;nbsp;ME to write better code&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;I believe that when&amp;nbsp;I truly follow TDD practices&amp;nbsp;my code comes out simpler.&amp;nbsp; I have also found, that my code tends to follow&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/YAGNI" target="_blank"&gt;YAGNI&lt;/a&gt;&amp;nbsp;more so then when I don&amp;#39;t follow TDD practices.&lt;/p&gt; &lt;p&gt;Here is an example from my past experience.&amp;nbsp; On a prior project I needed to build a &amp;#39;search engine&amp;#39; into our app (this was not an actual search engine, more like a hunt path engine).&amp;nbsp; When I first started out writing code I started out by creating all these classes and logic that I thought I would need.&amp;nbsp; After about 3-4 hours of coding I was dead in the water.&amp;nbsp; I was not able to solve my problem in a simple manner and I was frustrated.&amp;nbsp; I decided to take a step back and start over.&amp;nbsp; &lt;/p&gt; &lt;p&gt;This time though I&amp;nbsp;started out by writing test to mimic what I actually needed.&amp;nbsp; I continued to follow the principles of &lt;a href="http://en.wikipedia.org/wiki/Test-driven_development" target="_blank"&gt;TDD&lt;/a&gt; (btw, TDD is more then just about writing tests), within an hour or so I had my solution pretty much good to go.&amp;nbsp; All those classes and methods I THOUGHT I would need I did NOT.&amp;nbsp; I was able to scrap about 50% of the code/classes that I thought I needed.&amp;nbsp; And guess what, now I have a test suit to test my new code.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Allows ME to find more bugs during the development process&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;It has been my experience that I find more bugs while writing tests.&amp;nbsp; This is due to the fact that I not only follow TDD, but I also do my best to implement the &lt;a href="http://en.wikipedia.org/wiki/Fail-fast" target="_blank"&gt;Fail Fast Principle&lt;/a&gt;.&amp;nbsp; When I am writing my tests I have the ability to create tests that easily walk though the different pathways of my code (I attempt to hit 100% code coverage as well).&amp;nbsp; If I were not writing tests I would have to do this via the application, and&amp;nbsp;this is much more painful and it less likely that I would actually do it.&lt;/p&gt; &lt;p&gt;By writing my tests and testing my code during the development process I know that I have reduced my bug count significantly.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Makes ME feel more comfortable making changes&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;This is the beauty of TDD, I am not afraid to make any critical changes to my code because I KNOW that I have tests to verify if I screwed anything up.&amp;nbsp; &lt;/p&gt; &lt;p&gt;Have you ever run across some code that &amp;#39;you were scared&amp;#39; to change?&amp;nbsp; If you had tests for that code I bet you would a WHOLE LOT LESS scared to make any changes.&amp;nbsp; I know that I am.&lt;/p&gt; &lt;p&gt;A case in point for this is as follows.&amp;nbsp; On a prior project a consultant I was working with needed to make changes to some &amp;#39;smelly&amp;#39; logic.&amp;nbsp; This just happened to be a week or so before a scheduled release.&amp;nbsp; Beacuse he had NO confidence that the changes he would make would NOT break the application, he convinced the business to NOT make the changes. &amp;nbsp;I bet you a dollar that had there been unit tests he would have been much more willing to make the changes.&amp;nbsp; In this case the fact of NOT having tests may have caused the business to lose out on features it needed.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Improves MY code&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Because following TDD practices&amp;nbsp;forces you to write your failing code before your passing code,&amp;nbsp;I tend to implement my intent much cleaner and simpler.&amp;nbsp; I also know that because I am writing tests along the way my code is solid.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Allows ME to better convey intent&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;I know that tests are not a&amp;nbsp;substitution for&amp;nbsp;quality comments that convey intent, but they sure are the next best thing.&amp;nbsp; It is really nice to be able to point someone towards a suite of tests to &amp;#39;demo&amp;#39; how to use a component.&lt;/p&gt; &lt;p&gt;A case in point for this is as follows.&amp;nbsp; A few weeks ago at work I wrote an API to allow the querying of some data via our imaging system at work.&amp;nbsp; Turns out that an outside party needed to use this API for integration into on of our 3rd party applications.&amp;nbsp; When he came to me asking for &amp;#39;how do I use this&amp;#39;, I simply emailed him my suite of tests.&amp;nbsp; In this suite I had pretty much any conceivable use for the API.&amp;nbsp; To date the vendor has not asked me how to implement the API.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Allows MY tests to be automated and rerunable&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;This is a nice side effect of having tests.&amp;nbsp; Because we use&amp;nbsp;both NUnit and CruiseControl I can run my tests on every check in.&amp;nbsp; This is cool because now I (and the team) know if changes&amp;nbsp;I made&amp;nbsp;breaks some other part of the system.&amp;nbsp; I would rather know now then before QA hits it.&amp;nbsp; &lt;/p&gt; &lt;p&gt;The above are simply my opinion, if you don&amp;#39;t share the same opinions, let me know.&lt;/p&gt; &lt;p&gt;Till next time,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=38554" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Agile/default.aspx">Agile</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Methodology/default.aspx">Methodology</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/TDD/default.aspx">TDD</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Opinion/default.aspx">Opinion</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Featured/default.aspx">Featured</category></item><item><title>StructureMap Tip: Using Concrete classes as a PluginFamily</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/07/23/structuremap-tip-using-concrete-classes-as-a-pluginfamily.aspx</link><pubDate>Mon, 23 Jul 2007 22:43:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:35004</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=35004</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=35004</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/07/23/structuremap-tip-using-concrete-classes-as-a-pluginfamily.aspx#comments</comments><description>
&lt;p&gt;Have ever wanted to use a concrete class as both the the PluginFamily and Plugable (information on StructureMap's attributes &lt;a href="http://structuremap.sourceforge.net/Attributes.htm" target="_blank"&gt;here&lt;/a&gt;)&amp;nbsp;type in &lt;a href="http://structuremap.sourceforge.net/Default.htm" target="_blank"&gt;StructureMap&lt;/a&gt;?&amp;nbsp; I know I have, just today in fact (not the first time, but thought I would post about it this time)&amp;nbsp;I needed to do just this.&amp;nbsp; Why would I want to use a concrete class as both PluginFamily and Plugable type you may ask.&amp;nbsp; Well in this case because I wanted to use &lt;a href="http://en.wikipedia.org/wiki/Dependency_injection" target="_blank"&gt;DI&lt;/a&gt; to inject my configuration class into one of my objects (via constructor injection) and did not think it was worth the effort to create an interface.&lt;/p&gt;
 
&lt;p&gt;Normally if you were use an interface as the PluginFamily and a concrete class as the Plugable, your code would look something like below.&lt;/p&gt;
 
&lt;p&gt;&lt;b&gt;Interface&lt;/b&gt;&lt;/p&gt;
 
&lt;p&gt;[PluginFamily("FamilyNameGoesHere")]&lt;br&gt;public&amp;nbsp;interface IFoo &lt;br&gt;{&lt;/p&gt;
 
&lt;p&gt;&lt;b&gt;Concrete&lt;/b&gt;&lt;/p&gt;
 
&lt;p&gt;[Pluggable("FamilyNameGoeshere")]&lt;br&gt;public class Foo : IFoo&lt;br&gt;{&lt;/p&gt;
 
&lt;p&gt;Do have your concrete class act as both you simply combine the two as such&lt;/p&gt;
 
&lt;p&gt;[PluginFamily("FamilyNameGoesHere"), Pluggable("FamilyNameGoeshere")]&lt;br&gt;public class ConcreateWithNoInterface&lt;br&gt;{&lt;/p&gt;
 
&lt;p&gt;Keep in mind, that when you do not use interfaces with DI, you are taking away a lot of the power and flexibility that DI provides you.&amp;nbsp; But there are cases from time to time where this situation comes into play.&lt;/p&gt;
 
&lt;p&gt;Till next time,&lt;/p&gt;
&lt;br&gt;
&lt;a href="http://www.dotnetkicks.com/kick/?url=http://devlicio.us/blogs/derik_whittaker/archive/2007/07/23/structuremap-tip-using-concrete-classes-as-a-pluginfamily.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://devlicio.us/blogs/derik_whittaker/archive/2007/07/23/structuremap-tip-using-concrete-classes-as-a-pluginfamily.aspx" alt="kick it on DotNetKicks.com" border="0"&gt;&lt;/a&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=35004" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development+Tools/default.aspx">Development Tools</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Agile/default.aspx">Agile</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/.Net/default.aspx">.Net</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/TDD/default.aspx">TDD</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/StructureMap/default.aspx">StructureMap</category></item><item><title>Doh, there are 4 hours I will never get back</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/07/17/doh-there-is-4-hours-i-will-never-get-back.aspx</link><pubDate>Wed, 18 Jul 2007 01:28:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:34093</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=34093</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=34093</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/07/17/doh-there-is-4-hours-i-will-never-get-back.aspx#comments</comments><description>Today, I was working on one of my first ever (actually, it is my 2nd) WCF services. This service was meant to be pretty simple, 1 method with 4 param's. It should not take that long, or will it. To get the service started, I began by writing the library...(&lt;a href="http://devlicio.us/blogs/derik_whittaker/archive/2007/07/17/doh-there-is-4-hours-i-will-never-get-back.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://devlicio.us/aggbug.aspx?PostID=34093" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/TDD/default.aspx">TDD</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Humor/default.aspx">Humor</category></item><item><title>What I'm Learning</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/06/08/what-i-m-learning.aspx</link><pubDate>Fri, 08 Jun 2007 22:18:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:28014</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=28014</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=28014</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/06/08/what-i-m-learning.aspx#comments</comments><description>This post is in response to Sam Gentile's post over at code better I'm Learning Rhino Mocks NHibernate StructureMap Policy Injection Blocks Log4Ne t (yea I know, what took so long. Answer, last few apps use the Logging App Block) MonoRail (about to start...(&lt;a href="http://devlicio.us/blogs/derik_whittaker/archive/2007/06/08/what-i-m-learning.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://devlicio.us/aggbug.aspx?PostID=28014" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development+Tools/default.aspx">Development Tools</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Agile/default.aspx">Agile</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/TDD/default.aspx">TDD</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/StructureMap/default.aspx">StructureMap</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/NHibernate/default.aspx">NHibernate</category></item><item><title>Technical Debt, How we accumulate it, and how we can reduce it</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/05/25/technical-debt-how-we-accumulate-it-and-how-we-can-reduce-it.aspx</link><pubDate>Fri, 25 May 2007 14:03:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:26432</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=26432</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=26432</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/05/25/technical-debt-how-we-accumulate-it-and-how-we-can-reduce-it.aspx#comments</comments><description>All software projects will amass some amount of technical debt. This is not a necessarily bad thing; it is just he cost of doing business. As developers the only thing we can do is try to control/limit the amount of technical debt we build up. If you...(&lt;a href="http://devlicio.us/blogs/derik_whittaker/archive/2007/05/25/technical-debt-how-we-accumulate-it-and-how-we-can-reduce-it.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://devlicio.us/aggbug.aspx?PostID=26432" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Methodology/default.aspx">Methodology</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/TDD/default.aspx">TDD</category></item><item><title>Learning to use Mocks and the power they provide</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/05/23/learning-to-use-mocks-and-the-power-they-provide.aspx</link><pubDate>Wed, 23 May 2007 11:54:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:26297</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=26297</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=26297</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/05/23/learning-to-use-mocks-and-the-power-they-provide.aspx#comments</comments><description>Up until a few months ago I had never even attempted to use mocks ( NMock , RhinoMock , etc). Every time I would read about Mocking I thought to myself, this is kinda cool, but seems to be a waste of energy. At the time I saw Mocks as only a way to create...(&lt;a href="http://devlicio.us/blogs/derik_whittaker/archive/2007/05/23/learning-to-use-mocks-and-the-power-they-provide.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://devlicio.us/aggbug.aspx?PostID=26297" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Agile/default.aspx">Agile</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Methodology/default.aspx">Methodology</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/TDD/default.aspx">TDD</category></item><item><title>Handling Events in Unit Tests with anonymous delegates</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/04/23/handling-events-in-unit-tests-with-anonymous-delegates.aspx</link><pubDate>Mon, 23 Apr 2007 17:26:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:22990</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=22990</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=22990</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/04/23/handling-events-in-unit-tests-with-anonymous-delegates.aspx#comments</comments><description>
&lt;p&gt;Recently a co-worker of mine (Lou, smart guy… (Lou, your shameless plug)) needed to test a UI control that raised an event upon certain conditions.&amp;nbsp; In order to handle this event he needed to have some way to trap that it was raised. &amp;nbsp;&lt;br&gt;&lt;br&gt;The solution he came up with was simple and elegant.., use an anonymous delegate.&lt;br&gt;&lt;br&gt;Here is an example&lt;br&gt;
&lt;textarea class="c#:nogutter" name="code" rows="15" cols="50"&gt;// Create the UI container that is going to be tested
TripZipCodeRouteSelector tripZipCodeRouteSelector = new TripZipCodeRouteSelector();

// Create the local variable to handle the anonymous delegate call
bool eventRaised = false;

// Wire up the anonymous delegate call
tripZipCodeRouteSelector.InValidZipCodeProvided += delegate { eventRaised = true; };

// Run the code that should raise the event
tripZipCodeRouteSelector.OnZipCodeChanged( zipCode );

// Assert that the event was raised and it swapped the flag on the bool
Assert.AreEqual( true, eventRaised , "The event was not raised.");


&lt;/textarea&gt;
&lt;/p&gt;

&lt;p&gt;I thought this was pretty cool.&lt;br&gt;&lt;br&gt;Thanks Lou.....:)&lt;br&gt;&lt;br&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=22990" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Agile/default.aspx">Agile</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/TDD/default.aspx">TDD</category></item><item><title>Options Wanted: How do I handle my Mocks</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/04/17/options-wanted-how-do-i-handle-my-mocks.aspx</link><pubDate>Tue, 17 Apr 2007 12:35:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:22024</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=22024</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=22024</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/04/17/options-wanted-how-do-i-handle-my-mocks.aspx#comments</comments><description>
&lt;p&gt;I am looking for feedback from the group.&amp;nbsp; I am pretty new to using
mocks for my unit tests and I am not sure what the standard approach in the
community for usage of mocks in regards to how/where they are stored in your
test application.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p&gt;After refactoring some of my tests to use mocks I quickly noticed that I was
littering the same mock creation code in many of the unit tests.&amp;nbsp; So, the
first thing I did was create a local helper method inside my test. However, as
I continued my refactoring I was started to create the same helper method in
many classes.&amp;nbsp; After noticing what I was doing, I knew there had to be a
better way to do this.&lt;br&gt;
&lt;br&gt;
What I am thinking of doing is creating a ‘Mocks project’ that will only
contain static methods that can be called (with and without construction params)
to build and return a mock for a given interface. &lt;span&gt;&amp;nbsp;&lt;/span&gt;The reason I want separate class for this is
because 2 different projects use the same backend, but each have their own test
suite.&lt;/p&gt;

&lt;p&gt;Does this sound absurd?&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Thanks for any insight.&lt;br&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=22024" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Agile/default.aspx">Agile</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Methodology/default.aspx">Methodology</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/TDD/default.aspx">TDD</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/NMock/default.aspx">NMock</category></item></channel></rss>