<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/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>Being Cellfish : .Net</title><link>http://blogs.msdn.com/cellfish/archive/tags/.Net/default.aspx</link><description>Tags: .Net</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>How do I get someWin32API method to work in .Net?</title><link>http://blogs.msdn.com/cellfish/archive/2009/11/01/how-do-i-get-somewin32api-method-to-work-in-net.aspx</link><pubDate>Sun, 01 Nov 2009 21:11:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9915937</guid><dc:creator>cellfish</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/cellfish/comments/9915937.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cellfish/commentrss.aspx?PostID=9915937</wfw:commentRss><description>It was some time since I last needed to use &lt;A href="http://en.wikipedia.org/wiki/P/invoke" target=_blank mce_href="http://en.wikipedia.org/wiki/P/invoke"&gt;P/Invoke&lt;/A&gt; but it seems like I always need something from a standard C DLL or the Win32 API. Not that I needed it today, but I stumbled across this &lt;A title=pinvoke.net href="http://pinvoke.net/" target=_blank mce_href="http://pinvoke.net/"&gt;site&lt;/A&gt; which I will remember for future reference. Looks very helpful.&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9915937" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cellfish/archive/tags/.Net/default.aspx">.Net</category></item><item><title>Exceptions or not?</title><link>http://blogs.msdn.com/cellfish/archive/2009/10/01/exceptions-or-not.aspx</link><pubDate>Fri, 02 Oct 2009 08:01:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9902199</guid><dc:creator>cellfish</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/cellfish/comments/9902199.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cellfish/commentrss.aspx?PostID=9902199</wfw:commentRss><description>&lt;P&gt;I've always had mixed feelings for exceptions. First of all exceptions should only be used for exceptional things, not things that are expected. For example if you open a file it may fail for several reasons; it does not exists, you do not have rights to open it or it may be locked. These are all perfectly reasonable errors and throwing an exception for these failures is in my opinion not a great API design. If there are other methods to check for all these circumstances it might be OK but not optimal. A reasonable compromise is to have a TryOpen method which never throws an exception. This gives the user of the API&amp;nbsp;the option of letting file open errors being expected or fatal.&lt;/P&gt;
&lt;P&gt;Because exceptions should only be thrown for exceptional circumstances there should be no reason to catch them other in the application's main loop unless you can add information to the error in which case you want to wrap and throw a better exception. The exception to this rule is when you use an API (such as file open mentioned before) that throws for pretty common error cases you want to ignore.&lt;/P&gt;
&lt;P&gt;Another thing I don't like with exceptions is the fact that you (in C++ and C#, Java is better here) get no help from the compiler to know what types of exceptions a function may call. So in C++ and C# you may think you catch everything you need but you really don't which leads to unwanted behavior in your application. It is just too easy to get into a situation where you think a number of lines are going to be executed but they're not for some exception.&lt;/P&gt;
&lt;P&gt;However if you use return codes (as you would in a C program) you get your code cluttered with "if (previous called failed) handle error" which hides what the code really does. This can be hidden using macros to handle errors (ex: result = DoSomething ON_FAIL_RETURN(result); ). And if there is no error handling it is hard to know what happens when the next line is executed even though there was an error.&lt;/P&gt;
&lt;P&gt;Using exceptions is also a kind of "I failed and I hope somebody else somewhere can handle it" while the use of return codes defines a clear contract "I failed and you who called me must handle it". So even though exceptions are convenient, return codes feel more defensive, i.e. are easier to get right resulting in less bugs but sometimes at the cost of less clear code. As usual the mix of both approaches is probably the best. But there are more alternatives. If you use &lt;A href="http://blog.objectmentor.com/articles/2009/01/05/abstracting-away-from-exceptions" target=_blank mce_href="http://blog.objectmentor.com/articles/2009/01/05/abstracting-away-from-exceptions"&gt;adverse as described by Feathers&lt;/A&gt; I'm prepared to accept exceptions to a much larger degree because they're being handled immediately so it reminds of the return code approach.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9902199" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cellfish/archive/tags/Java/default.aspx">Java</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/.Net/default.aspx">.Net</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/C_2B002B00_/default.aspx">C++</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/Development/default.aspx">Development</category></item><item><title>Remember to allocate memory just in case you run out of memory</title><link>http://blogs.msdn.com/cellfish/archive/2009/08/10/remember-to-allocate-memory-just-in-case-you-run-out-of-memory.aspx</link><pubDate>Tue, 11 Aug 2009 07:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9863808</guid><dc:creator>cellfish</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/cellfish/comments/9863808.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cellfish/commentrss.aspx?PostID=9863808</wfw:commentRss><description>&lt;P&gt;Today I read this &lt;A href="http://blogs.msdn.com/tess/archive/2009/08/10/why-do-i-see-executionengineexception-stackoverflowexception-and-outofmemoryexception-on-the-heap-when-debugging-net-applications.aspx" target=_blank mce_href="http://blogs.msdn.com/tess/archive/2009/08/10/why-do-i-see-executionengineexception-stackoverflowexception-and-outofmemoryexception-on-the-heap-when-debugging-net-applications.aspx"&gt;blog post&lt;/A&gt; about how all .Net applications create three exceptions upon start; System.ExecutionEngineException, System.StackOverflowException and System.OutOfMemoryException. The reason is that if these are not allocated from the start, they cannot be created when they occur. This reminded me of when I was writing high performance &lt;A href="http://en.wikipedia.org/wiki/Daemon_(computer_software)" target=_blank mce_href="http://en.wikipedia.org/wiki/Daemon_(computer_software)"&gt;daemons&lt;/A&gt; in C a few years ago.&lt;/P&gt;
&lt;P&gt;In those daemons I did a number of things to prepare for the event of memory starvation. First of all I allocated some memory (a few Kb if I remember correctly). If the daemon ran out of memory it was&amp;nbsp;suspended for up to a second and the memory allocation was tried again. Typically I did a handful of retries and if they all failed I released the preallocated memory, logged the error and terminated the process.&lt;/P&gt;
&lt;P&gt;The reasoning behind this strategy was based on three assumptions. First of all, if a process cannot allocate memory it is because some other process is leaking memory (or is just using a lot of memory). Second assumption is that the offending process will terminate fairly quickly because of this. Last assumption is that if the offending process does not release memory quick enough it might be the current process that is the problem so it must terminate to let other processes proceed normally. But before termination we release some preallocated memory so that we have enough memory to log the problem.&lt;/P&gt;
&lt;P&gt;So what about multi-threaded daemons? If one thread releases some memory another might take it all before we get the chance to log the problem. Well, in my case all daemons were single threaded. If I needed "threads" (which was rare) I &lt;A href="http://en.wikipedia.org/wiki/Fork_(software_development)" target=_blank mce_href="http://en.wikipedia.org/wiki/Fork_(software_development)"&gt;forked&lt;/A&gt;. So that was not a problem I had to consider.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9863808" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cellfish/archive/tags/.Net/default.aspx">.Net</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/C_2B002B00_/default.aspx">C++</category></item><item><title>Fun introduction to F#</title><link>http://blogs.msdn.com/cellfish/archive/2009/05/12/fun-introduction-to-f.aspx</link><pubDate>Wed, 13 May 2009 01:49:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9608342</guid><dc:creator>cellfish</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/cellfish/comments/9608342.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cellfish/commentrss.aspx?PostID=9608342</wfw:commentRss><description>&lt;P&gt;There is a very funny introduction to F# available &lt;A href="http://channel9.msdn.com/pdc2008/TL11/" target=_blank mce_href="http://channel9.msdn.com/pdc2008/TL11/"&gt;here&lt;/A&gt;. So if you want an introduction to F# and/or a few laughs you should watch it.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9608342" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cellfish/archive/tags/.Net/default.aspx">.Net</category></item><item><title>Refactoring for dummies</title><link>http://blogs.msdn.com/cellfish/archive/2008/11/03/refactoring-for-dummies.aspx</link><pubDate>Mon, 03 Nov 2008 15:13:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9032464</guid><dc:creator>cellfish</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/cellfish/comments/9032464.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cellfish/commentrss.aspx?PostID=9032464</wfw:commentRss><description>&lt;P&gt;I was recently looking at a web-cast and it was not related to refactoring at all, but the presenter said something about refactoring that just blew my mind. The code he started with looked something like this:&lt;/P&gt;&lt;PRE&gt;&lt;FONT color=#0000ff&gt;public&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#2b91af&gt;ClassD&lt;/FONT&gt; GetD()
{
    &lt;FONT color=#2b91af&gt;ClassA&lt;/FONT&gt; a = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ClassA&lt;/FONT&gt;();
    &lt;FONT color=#2b91af&gt;ClassB&lt;/FONT&gt; b = a.GetB();
    &lt;FONT color=#2b91af&gt;ClassC&lt;/FONT&gt; c = b.GetC();
    &lt;FONT color=#2b91af&gt;ClassD&lt;/FONT&gt; d = c.GetD();
    &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; d;
}&lt;/PRE&gt;
&lt;P&gt;&lt;/FONT&gt;He then had the nerve to &lt;EM&gt;refactor for better performance&lt;/EM&gt; into this:&lt;/P&gt;&lt;PRE&gt;&lt;FONT color=#0000ff&gt;public&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#2b91af&gt;ClassD&lt;/FONT&gt; GetD()
{
    &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; (&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;ClassA&lt;/FONT&gt;()).GetB().GetC().GetD();
}&lt;/PRE&gt;
&lt;P&gt;The only thing he did was make the code harder to read. If you use&amp;nbsp;a &lt;A class="" href="http://www.netdecompiler.com/index.html" target=_blank mce_href="http://www.netdecompiler.com/index.html"&gt;disassembler like this one&lt;/A&gt; to actually look at the generated code. And yes there is a difference in the number of lines of IL that is generated but I feel confident enough that those differences will be removed when the code is compiled to native code before execution. So the only thing accomplished by this refactoring is that the code is harder to read (original example had much longer method names) and the possibility to say "&lt;EM&gt;look how easy this is to use, it's only a single line of code&lt;/EM&gt;". hate to break this to you but I can write &lt;EM&gt;anything and everything&lt;/EM&gt; on a single line if that is important for you. But that doesn't make it better.&lt;/P&gt;
&lt;P&gt;Don't refactor for performance unless you know you have a performance issue. Don't refactor to get fewer lines of code. Refactor to remove duplicate code and to make the code easier to understand, not making it harder to understand.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9032464" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cellfish/archive/tags/.Net/default.aspx">.Net</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/Tools/default.aspx">Tools</category></item><item><title>Beginners should not use LINQ</title><link>http://blogs.msdn.com/cellfish/archive/2008/10/17/beginners-should-not-use-linq.aspx</link><pubDate>Fri, 17 Oct 2008 20:01:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9000379</guid><dc:creator>cellfish</dc:creator><slash:comments>12</slash:comments><comments>http://blogs.msdn.com/cellfish/comments/9000379.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cellfish/commentrss.aspx?PostID=9000379</wfw:commentRss><description>&lt;P&gt;When I first heard of LINQ I got really scared. I could see that it was a very powerful tool but also a tool that would be easy to abuse. Most experienced developers tend to agree that putting SQL statements into your logic or even GUI code is a bad design. Beginners tend to realize this pretty soon too. But with LINQ we get the opportunity to do the same kind of bad design once again. And since it is ".Net code" rather than "SQL statement" I had a fear that it would take longer before the beginners learned their lesson. And why do I care? I don't know. Guess I'm just one of those guys who want everybody to do a good job.&lt;/P&gt;
&lt;P&gt;Since LINQ was introduced I have not really seen LINQ in action very in any real code so I kind of forgot about this. But then I read &lt;A class="" title="LINQ is Just Another Query Language!" href="http://www.lowendahl.net/showShout.aspx?id=229" target=_blank mce_href="http://www.lowendahl.net/showShout.aspx?id=229"&gt;this&lt;/A&gt;. Looks like I was right. LINQ is being abused just in the way I feared. But I'm happy to see that a person who I've heard speak warmly about LINQ so many times finally points out how LINQ can be your gate to bad design. And remember to read the comments too when you follow the link above. The topic unfolds...&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;UPDATE:&lt;/STRONG&gt; Not only did the topic unfold in the linked thread. It unfolded here. If you just found this page I strongly suggest you read all the comments.&lt;/EM&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9000379" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cellfish/archive/tags/.Net/default.aspx">.Net</category></item><item><title>Exit Mocks. Enter Stubs!</title><link>http://blogs.msdn.com/cellfish/archive/2008/10/14/exit-mocks-enter-stubs.aspx</link><pubDate>Tue, 14 Oct 2008 12:13:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8999222</guid><dc:creator>cellfish</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/cellfish/comments/8999222.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cellfish/commentrss.aspx?PostID=8999222</wfw:commentRss><description>&lt;P&gt;Since &lt;A class="" title="I don't like Mock objects" href="http://blogs.msdn.com/cellfish/archive/2008/05/24/i-don-t-like-mock-objects.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2008/05/24/i-don-t-like-mock-objects.aspx"&gt;I'm not a fan of mocks&lt;/A&gt; I guess my prayers have been heard.&amp;nbsp;Microsoft Research &lt;A class="" title="Pex gets a Stubs framework (I said stubs, not mocks)" href="http://blog.dotnetwiki.org/PexGetsAStubsFrameworkISaidStubsNotMocks.aspx" target=_blank mce_href="http://blog.dotnetwiki.org/PexGetsAStubsFrameworkISaidStubsNotMocks.aspx"&gt;will soon release a stub framework&lt;/A&gt;. That's right. Stubs and not mocks! It is part of &lt;A class="" title="Code Coverage" href="http://blogs.msdn.com/cellfish/archive/2008/06/16/code-coverage.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2008/06/16/code-coverage.aspx"&gt;Pex that I have mentioned before&lt;/A&gt;. And you don't need to use Pex if you don't want. You can just use the stub framework by it self.&lt;/P&gt;
&lt;P&gt;The new stub framework can currently be used to stub interfaces. It creates the stubs by generating code. At first this scared me since I feared it would not regenerate the stubs when the interface changed (which might happen quite common when creating the interface using BDD). But it works just fine and detects changes in the assembly and regenerates the stubs. Very convenient.&lt;/P&gt;
&lt;P&gt;Another convenient thing is that it supplies default implementations for methods if I want. The default is to throw an &lt;FONT face=Courier&gt;StubNotImplementedException&lt;/FONT&gt; but I can change that and return default values (null, 0, empty string etc) if that is what I want. And the change can be made globally for all stubs created after the change or for a single stub object.&lt;/P&gt;
&lt;P&gt;So how does this work? Consider the following interface:&lt;/P&gt;&lt;PRE&gt;&lt;FONT color=#0000ff&gt;public interface&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;IMyInterface&lt;/FONT&gt;
{
    &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; DoStuff();
}&lt;/PRE&gt;
&lt;P&gt;I just tell the stub framework to generate stubs for the assembly containing the interface and it will generate a new namespace with the stubs. If &lt;FONT face=Courier&gt;IMyInterface&lt;/FONT&gt; is part of &lt;FONT face=Courier&gt;MyNamespace&lt;/FONT&gt; the stub framework will create a new namespace &lt;FONT face=Courier&gt;MyNamespace.Stubs&lt;/FONT&gt; with a class &lt;FONT face=Courier&gt;SMyInterface&lt;/FONT&gt;. Now we want to make a test. The test below doesn't really make since since it tests the stub instead of something using the stub, but I want to show the code that makes the stub work without the surrounding stuff so bare with me...&lt;/P&gt;&lt;PRE&gt;&lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; TestStub()
{
    MyNamespace.Stubs.&lt;FONT color=#2b91af&gt;SMyInterface&lt;/FONT&gt; o = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; MyNamespace.Stubs.&lt;FONT color=#2b91af&gt;SMyInterface&lt;/FONT&gt;();
    MyNamespace.&lt;FONT color=#2b91af&gt;IMyInterface&lt;/FONT&gt; i = o;
    Assert.Equal(42, i.DoStuff());
}&lt;/PRE&gt;
&lt;P&gt;Now the test will fail since the stub will throw an exception since the stub is not implemented. Let's use the default implementation:&lt;/P&gt;&lt;PRE&gt;&lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; TestStub()
{
    MyNamespace.Stubs.&lt;FONT color=#2b91af&gt;SMyInterface&lt;/FONT&gt; o = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; MyNamespace.Stubs.&lt;FONT color=#2b91af&gt;SMyInterface&lt;/FONT&gt;();
    o.DefaultStub = Microsoft.Stubs.&lt;FONT color=#2b91af&gt;DefaultStub&lt;/FONT&gt;&amp;lt;MyNamespace.Stubs.&lt;FONT color=#2b91af&gt;SMyInterface&lt;/FONT&gt;&amp;gt;.DefaultValue;
    MyNamespace.&lt;FONT color=#2b91af&gt;IMyInterface&lt;/FONT&gt; i = o;
    Assert.Equal(42, i.DoStuff());
}&lt;/PRE&gt;
&lt;P&gt;Still a failure since the stub returns zero for &lt;FONT face=Courier&gt;DoStuff()&lt;/FONT&gt;. Let's stub that method.&lt;/P&gt;&lt;PRE&gt;&lt;FONT color=#0000ff&gt;void&lt;/FONT&gt; TestStub()
{
    MyNamespace.Stubs.&lt;FONT color=#2b91af&gt;SMyInterface&lt;/FONT&gt; o = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; MyNamespace.Stubs.&lt;FONT color=#2b91af&gt;SMyInterface&lt;/FONT&gt;();
    o.DefaultStub = Microsoft.Stubs.&lt;FONT color=#2b91af&gt;DefaultStub&lt;/FONT&gt;&amp;lt;MyNamespace.Stubs.&lt;FONT color=#2b91af&gt;SMyInterface&lt;/FONT&gt;&amp;gt;.DefaultValue;
    o.DoStuff = (stub) =&amp;gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; 42; };
    MyNamespace.&lt;FONT color=#2b91af&gt;IMyInterface&lt;/FONT&gt; i = o;
    Assert.Equal(42, i.DoStuff());
}&lt;/PRE&gt;
&lt;P&gt;Now the test passes! I think this new framework is an excellent addition to the developer's toolbox. And I think it is a better starting framework than all the mock frameworks&amp;nbsp;out there. In the few cases that a mock framework is really needed (over a stub framework) you can easily extend your stub to verify behavior in the same way as a mock does. Currently the stub framework have a few limitations such as only being able stub interfaces. But I'll guess we'll have to wait and see what will be part of the release once it is available to the public&amp;nbsp;(&lt;EM&gt;when writing this I've been using an internal release available to Microsoft staff only&lt;/EM&gt;).&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8999222" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cellfish/archive/tags/Test/default.aspx">Test</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/.Net/default.aspx">.Net</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/Tools/default.aspx">Tools</category></item><item><title>My new favorite .Net unit test framework</title><link>http://blogs.msdn.com/cellfish/archive/2008/09/24/my-new-favorite-net-unit-test-framework.aspx</link><pubDate>Wed, 24 Sep 2008 11:53:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8962542</guid><dc:creator>cellfish</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/cellfish/comments/8962542.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cellfish/commentrss.aspx?PostID=8962542</wfw:commentRss><description>&lt;P&gt;I recently had a chance to really sink my teeth into &lt;A class="" title=xUnit.net href="http://www.codeplex.com/xunit/" target=_blank mce_href="http://www.codeplex.com/xunit/"&gt;xUnit.net&lt;/A&gt;. Since I've been stuck with &lt;A class="" title=CPPUnit href="http://sourceforge.net/projects/cppunit/" target=_blank mce_href="http://sourceforge.net/projects/cppunit/"&gt;CPPUnit&lt;/A&gt; for quite some time and working with xUnit.net was a relief. Compared to NUnit I find xUnit much easier and convenient to work with (and compared with CPPUnit it's in a class of it own).&lt;/P&gt;
&lt;P&gt;I feel I must give you four good reasons (no particular order)&amp;nbsp;for why I prefer xUnit.net:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;xcopy install makes it incredible easy to use it anywhere it is needed and in any form. Even different versions.&lt;/LI&gt;
&lt;LI&gt;No need to mark up fixtures and test suits with attributes. A test method can basically be put anywhere.&lt;/LI&gt;
&lt;LI&gt;No weird assertion names that feels like just a tick in the feature list. A small set of useful asserts.&lt;/LI&gt;
&lt;LI&gt;Testing for exceptions is an assertion and not a test method attribute.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;So &lt;A class="" title="Yet another unit test framework for .Net released" href="http://blogs.msdn.com/cellfish/archive/2008/04/24/yet-another-unit-test-framework-for-net-released.aspx" target=_blank mce_href="http://blogs.msdn.com/cellfish/archive/2008/04/24/yet-another-unit-test-framework-for-net-released.aspx"&gt;earlier I suggested&lt;/A&gt; you to take a look at xUnit. Now I'm &lt;EM&gt;telling&lt;/EM&gt; you.&amp;nbsp;You won't be disappointed!&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8962542" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cellfish/archive/tags/BDD/default.aspx">BDD</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/Test/default.aspx">Test</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/.Net/default.aspx">.Net</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/TDD/default.aspx">TDD</category></item><item><title>The implementation of iterators in C# and its consequences</title><link>http://blogs.msdn.com/cellfish/archive/2008/08/23/the-implementation-of-iterators-in-c-and-its-consequences.aspx</link><pubDate>Sat, 23 Aug 2008 09:23:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8880993</guid><dc:creator>cellfish</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/cellfish/comments/8880993.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cellfish/commentrss.aspx?PostID=8880993</wfw:commentRss><description>&lt;P&gt;Recently &lt;A class="" title=OldNewThing href="http://blogs.msdn.com/oldnewthing/" target=_blank mce_href="http://blogs.msdn.com/oldnewthing/"&gt;oldnewthing&lt;/A&gt; wrote a series av articles on C# iterators. Especially part four is interesting since it describes how iterators can be used to simplify asynchronous code. I'm not a big fan of this kind of exploit of a programming language since there is a risk the code is harder to understand for new developers looking at the code but it is never the less intriguing to read about.&lt;/P&gt;
&lt;P&gt;Now you should not skip ahead and read part four first. Read them all in order: &lt;A class="" title="Part 1" href="http://blogs.msdn.com/oldnewthing/archive/2008/08/12/8849519.aspx" target=_blank mce_href="http://blogs.msdn.com/oldnewthing/archive/2008/08/12/8849519.aspx"&gt;one&lt;/A&gt; &lt;A class="" title="Part 2" href="http://blogs.msdn.com/oldnewthing/archive/2008/08/13/8854601.aspx" target=_blank mce_href="http://blogs.msdn.com/oldnewthing/archive/2008/08/13/8854601.aspx"&gt;two&lt;/A&gt; &lt;A class="" title="Part 3" href="http://blogs.msdn.com/oldnewthing/archive/2008/08/14/8862242.aspx" target=_blank mce_href="http://blogs.msdn.com/oldnewthing/archive/2008/08/14/8862242.aspx"&gt;three&lt;/A&gt; &lt;A class="" title="Part 4" href="http://blogs.msdn.com/oldnewthing/archive/2008/08/15/8868267.aspx" target=_blank mce_href="http://blogs.msdn.com/oldnewthing/archive/2008/08/15/8868267.aspx"&gt;four&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8880993" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cellfish/archive/tags/.Net/default.aspx">.Net</category></item><item><title>C# source analysis</title><link>http://blogs.msdn.com/cellfish/archive/2008/06/14/c-source-analysis.aspx</link><pubDate>Sat, 14 Jun 2008 13:45:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8590352</guid><dc:creator>cellfish</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/cellfish/comments/8590352.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cellfish/commentrss.aspx?PostID=8590352</wfw:commentRss><description>&amp;nbsp; 
&lt;P style="FONT-SIZE: 11pt; MARGIN: 0in; FONT-FAMILY: Calibri"&gt;And if you listened to me and started to &lt;A class="" title="Readable SQL" href="http://blogs.msdn.com/cellfish/archive/2008/06/12/readable-sql.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2008/06/12/readable-sql.aspx"&gt;write nice looking SQL&lt;/A&gt;, maybe you wanna look ate &lt;A class="" title="Source Analysis Blog" href="http://blogs.msdn.com/sourceanalysis/" target=_blank mce_href="http://blogs.msdn.com/sourceanalysis/"&gt;making your C# code look nice&lt;/A&gt; too... &lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8590352" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cellfish/archive/tags/.Net/default.aspx">.Net</category></item><item><title>Robot competitions</title><link>http://blogs.msdn.com/cellfish/archive/2008/04/28/robot-competitions.aspx</link><pubDate>Mon, 28 Apr 2008 09:13:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8434542</guid><dc:creator>cellfish</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/cellfish/comments/8434542.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cellfish/commentrss.aspx?PostID=8434542</wfw:commentRss><description>Even though I never played &lt;A class="" title=Crobots href="http://en.wikipedia.org/wiki/Crobots" target=_blank mce_href="http://en.wikipedia.org/wiki/Crobots"&gt;crobots&lt;/A&gt;, I have always been intrigued by the idea. I even played &lt;A class="" title=RoboForge href="http://roboforge.net/" target=_blank mce_href="http://roboforge.net/"&gt;RoboForge&lt;/A&gt; for a few months a couple of years ago. And today I stumbled across a new robot game; &lt;A class="" title=RoboChamp href="http://www.robochamps.com/" target=_blank mce_href="http://www.robochamps.com/"&gt;RoboChamps&lt;/A&gt;. RoboChamps does not seem to be like all other classical robot combat games but introduces a number of robot challenges of which only one has been released so far. And navigating a maze avoiding traps does not sound like much action but I guess when the sumo challenge is released things will get a little bit more interesting. I think I just found myself a new spare time project...&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8434542" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cellfish/archive/tags/.Net/default.aspx">.Net</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/Robot/default.aspx">Robot</category></item><item><title>Yet another unit test framework for .Net released</title><link>http://blogs.msdn.com/cellfish/archive/2008/04/24/yet-another-unit-test-framework-for-net-released.aspx</link><pubDate>Thu, 24 Apr 2008 09:09:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8420916</guid><dc:creator>cellfish</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/cellfish/comments/8420916.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cellfish/commentrss.aspx?PostID=8420916</wfw:commentRss><description>&lt;P&gt;Version 1.0 of &lt;A class="" title="xUnit.net @ codeplex" href="http://www.codeplex.com/xunit" target=_blank mce_href="http://www.codeplex.com/xunit"&gt;xUnit.net&lt;/A&gt; has been &lt;A class="" href="http://bradwilson.typepad.com/blog/2008/04/xunitnet-10-rel.html" target=_blank mce_href="http://bradwilson.typepad.com/blog/2008/04/xunitnet-10-rel.html"&gt;released&lt;/A&gt;. So do we need another unit test framework? And I think the answer is &lt;EM&gt;yes&lt;/EM&gt;. There are a number of things that I've found a little bit weird in &lt;A class="" title=NUnit href="http://nunit.org/" target=_blank mce_href="http://nunit.org/"&gt;NUnit&lt;/A&gt; and with xUnit.net they have been removed. I definitely think that you should take a closer look at &lt;A class="" href="http://www.codeplex.com/xunit/Wiki/View.aspx?title=WhyDidWeBuildXunit&amp;amp;referringTitle=Home" target=_blank mce_href="http://www.codeplex.com/xunit/Wiki/View.aspx?title=WhyDidWeBuildXunit&amp;amp;referringTitle=Home"&gt;why xUnit.net was written&lt;/A&gt; and the &lt;A class="" href="http://www.codeplex.com/xunit/Wiki/View.aspx?title=Comparisons&amp;amp;referringTitle=Home" target=_blank mce_href="http://www.codeplex.com/xunit/Wiki/View.aspx?title=Comparisons&amp;amp;referringTitle=Home"&gt;comparison with other&lt;/A&gt; unit test frameworks. xUnit.net definitely feels like a new fresh wind in the TDD/BDD toolbox.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8420916" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cellfish/archive/tags/BDD/default.aspx">BDD</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/Test/default.aspx">Test</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/.Net/default.aspx">.Net</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/TDD/default.aspx">TDD</category></item><item><title>Selenium the test tool</title><link>http://blogs.msdn.com/cellfish/archive/2008/04/09/selenium-the-test-tool.aspx</link><pubDate>Wed, 09 Apr 2008 21:39:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8373032</guid><dc:creator>cellfish</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/cellfish/comments/8373032.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cellfish/commentrss.aspx?PostID=8373032</wfw:commentRss><description>&lt;P&gt;I almost forgot that before the &lt;A class="" title="BDD and DDD" href="http://blogs.msdn.com/cellfish/archive/2008/04/09/bdd-and-ddd.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2008/04/09/bdd-and-ddd.aspx"&gt;BDD/DDD presentation&lt;/A&gt;, there was a presentation about &lt;A class="" title="Selenium - the test tool" href="http://en.wikipedia.org/wiki/Selenium_%28software%29" target=_blank mce_href="http://en.wikipedia.org/wiki/Selenium_%28software%29"&gt;Selenium&lt;/A&gt;. I didn't forget it because it was a bad presentation but because the following presentation was so good...&lt;/P&gt;
&lt;P&gt;I've never had any good experiences with tools for automatic testing but I must confess that Selenium looks nice.&amp;nbsp; At least if you want to add regression tests to an existing GUI. And it is a web based GUI. So if those two fact apply to you, you should take a look at Selenium I think.&lt;/P&gt;
&lt;P&gt;Selenium is good at recording actions and create test code. And it creates test code for unit tests frameworks such as NUnit and a whole bunch of other languages such as Python, Java, Ruby, PHP and more. However there seems to be some stability problems at the moment. According to the presenter (I have not found a link to verify this); Google have more than 51000 selenium tests in their projects. 96% of the tests run with no problem, 2% have problems due to confirmed bugs in Selenium and the last 2% are tests failing where the reason&amp;nbsp; is unclear (Selenium vs the code tested). &lt;/P&gt;
&lt;P&gt;This is a common problem I see when I work with open source. Open source applications are typically quite useful and easy to use 99% of the time. But I always tend to end up needing the last percent which is never implemented or have bugs. And the reason for this is usually that no one have bothered to implement the last tricky advanced feature I end up needing. You probably wanna know why I do not sit down and implement that feature and contribute it back to the open source community. Well that is a whole other topic and I will write about that it the near future.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8373032" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cellfish/archive/tags/PHP/default.aspx">PHP</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/Test/default.aspx">Test</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/Java/default.aspx">Java</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/Ruby/default.aspx">Ruby</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/Python/default.aspx">Python</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/Open+source/default.aspx">Open source</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/.Net/default.aspx">.Net</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/Tools/default.aspx">Tools</category></item></channel></rss>