First impressions of xUnit.net#

xUnit.net is awesome!  Some very useful features, has everything you need for unit testing and some very useful attributes for data driven integration tests like:

  • AutoRollBack
  • DataViaOleDB
  • DataViaSqlServer
  • DataViaXls

It is very intuitive to use and is simple.  I’m still digging into it but I’m pretty stoked so far.

Friday, September 21, 2007 12:19:33 AM (GMT Standard Time, UTC+00:00) #    Comments [0]  | 

 

xUnit.net has arrived!#

A new testing framework is in town, xUnit.net.  Jim talks about it in his post.

I’m taking xUnit.net for a test drive as I type.

Go check it out!

Thursday, September 20, 2007 10:27:06 PM (GMT Standard Time, UTC+00:00) #    Comments [0]  | 

 

WatiN Test Recorder#
WatiN Test Recorder is a pretty cool tool for recording user actions.  I have used Watir Recorder in the past and I have been waiting for a .NET version and now there is one!  If you are in need of a test automation tool check out WatiN Test Recorder.  There is a nice flash demo on the home page.
Wednesday, September 19, 2007 2:53:06 PM (GMT Standard Time, UTC+00:00) #    Comments [0]  | 

 

Custom Resharper Type Members Layout#

My good friend Daren May put together a custom type members layout for Resharper.  This a a newer feature in Resharper that allows someone to define a custom code format in xml.  To do this follow the steps below.

1) Go to Resharper’s “Options” page in Visual Studio

ResharperOptions

2) Select the “Type Member Layout” in the navigation tree then unselect “Use Default Patterns”.

ResharperTypeMemberLayout1

3) Take the contents of this xml file and paste it into the “Custom Patterns” window.

ResharperTypeMemberLayout2

4) Format your code in Visual Studio.  This can be done by using Resharper’s context menu or by hit ctrl+alt+F  Be sure to have the “Reorder type members checked”.

ResharperReformatCode

Wednesday, September 19, 2007 2:29:24 PM (GMT Standard Time, UTC+00:00) #    Comments [0]  | 

 

Acronis Disk Director in Action#

I recently purchased Acronis Disk Director instead of Partition Magic and I’m very pleased.  Disk Director is easy to use and makes editing disks a snap.  Check it out if you are in need of a good disk editing tool.

AcronisDiskDirector

Monday, September 10, 2007 9:13:28 PM (GMT Standard Time, UTC+00:00) #    Comments [0]  | 

 

It's a Girl!#

Today my wife and I found out that in January we will be welcoming a new little girl into our family.  I think she is actually smiling in the picture.  Watch out world, here comes another Luif!

BabyFace

Friday, September 07, 2007 8:13:57 PM (GMT Standard Time, UTC+00:00) #    Comments [0]  | 

 

JetBrains UnitRun "No such interface supported"#

I recently built up a new VM for my team and decided to use JetBrains UnitRun.  After installing UnitRun I started up Visual Studio 2005 I was greeted with the exception:

“JetBrains.ReSharper.Util.InternalErrorException: No such interface supported
StackTrace…..”

I also noticed that the [Test] attribute was not colored making it look like it was not being resolved though everything compiled just fine.  Turns out it is the namespacing.  This is not a UnitRun issue it is a Visual Studio issue.  I have something that looks like:

    4 using NUnit.Framework;

    5 

    6 namespace Foo.Bar.Test.UnitTests

    7 {

    8     [TestFixture]

    9     public class MockFixture

   10     {

   11         [Test]

   12         public void ExceptionIsDrivingMeNuts()

   13         {

   14         }

   15     }

   16 }

Notice the namespace has the “Foo.Bar.Test.UnitTests” and that [Test] attribute is not colored.  Visual Studio is resolving [Test] as the namespace “Foo.Bar.Test” instead of NUnit.Framework.TestAttribute.  So why have I not seen this sooner?  Well I use Resharper which resolves it to the correct reference and thus colors it correctly.  Looks like Visual Studio walks the using statements/namespace in reverse order and the first string match it finds it uses it.  This is illustrated by the below which works.

    5 namespace Foo.Bar.Test.UnitTests

    6 {

    7    using NUnit.Framework;

    8 

    9    [TestFixture]

   10    public class MockFixture

   11    {

   12       [Test]

   13       public void ExceptionIsDrivingMeNuts()

   14       {

   15       }

   16    }

   17 }

 

This is not something I’m willing to live with.  The underlying problem is the namespace so the fix I’m going with is to update the namespace to “Foo.Bar.Tests.UnitTests” which produces the below which works great.

 

    4 using NUnit.Framework;

    5 

    6 namespace Foo.Bar.Tests.UnitTests

    7 {

    8    [TestFixture]

    9    public class MockFixture

   10    {

   11       [Test]

   12       public void ExceptionIsDrivingMeNuts()

   13       {

   14       }

   15    }

   16 }

 

I guess another fix is to get everyone using Resharper…

Thursday, September 06, 2007 9:22:13 PM (GMT Standard Time, UTC+00:00) #    Comments [0]  | 

 

WCF Basics#

Recently I have been talking about and reviewing WCF (Windows Communication Foundation) implementations.  There are some basic pieces of information that each team seems to be missing.  WCF services are not your grandmother’s web service.  Many things differ from a WCF service and a .NET 1.1 Web Service.

  • WCF Data Contracts work on an opt in basis when the DataContractSerializer (the default) is used.  This means each member that is to be serialized needs to be decorated with the DataMember attribute.
  • The preferred mode of instance management for WCF is per call.  This means that for each call an instance of the service is created and then disposed once the call finishes.  This also means there are only as many instances of the services as there are calls.  There are three different types of instance management:  per call, per session, and singleton.  The per session instance management is how a .NET 1.1 web service works.  Per session instance management creates an instance of the service for the entire length of the session in which many operation (i.e. calls) can be made.  In the per session mode there would be an instance of the service for each client.  Singleton instance management is just what it sounds like, there is one and only one instance of the services for all calls.  Per call is the most scalable and singleton is the least which leaves per session somewhere in the middle.  Don’t confuse scalability with performance.  Performance actually goes the opposite direction; Singleton is the best and per call is the worst which again leaves per session in the middle.  Most systems I have been designing lately have been more message based so the per call instance management works best.  On a side note instance management is driven by behaviors which is a bit beyond the scope of this post.
  • Choose your bindings wisely.  When picking a binding be sure you know what you are picking and also know you are not tied to that binding for eternity.  Currently most cases I see are in need of the HttpBasicBinding because of the need for interoperability.  I also tend to recommend the HttpBasicBinding because none of the added features of the other bindings are needed.  Currently I point people towards bindings that can be hosted in IIS for simplicity sake.  It will not be long until bindings like the NetTcpBinding which supports the binary formatter can be hosted in IIS 7 using WAS (Windows Process Activation Service).
  • The difference between transport and message level encryption is an important point.  Transport encryption means having a secure tunnel to communicate over like SSL. Message level encryption means the message itself is encrypted so wherever the message goes it will need to be decrypted before it can be used.  As is the case with any encryption there is overhead.  Transport level encryption is faster than message level encryption.  In some cases when none sensitive information is being transmitted behind a firewall the option of TransportCredentialsOnly comes in handy.  This means that only credentials are passed along with the call but no encryption is used.  I would recommend thinking long and hard before deploying any solution with no encryption.

WCF in .NET 3.0 definitely has it short coming, like the DataContractSerializer not working with attributes, but it is much better than the .NET 1.1 way of doing web services.  If you are currently working with or thinking of working with WCF I would suggest looking at Web Service Factory created by Microsoft Patterns and Practices.

Wednesday, September 05, 2007 12:25:51 AM (GMT Standard Time, UTC+00:00) #    Comments [0]  | 

 

WCF Development Tools#
I get the question a lot about where the gui trace viewer and gui config tool are located for WCF.  It is not as easy as one may think to get these because they are in an unexpected place; the Windows Vista SDK.
Tuesday, September 04, 2007 11:53:07 PM (GMT Standard Time, UTC+00:00) #    Comments [0]  | 

 

All content © 2008, John Luif
On this page
This site
Calendar
<November 2008>
SunMonTueWedThuFriSat
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456
Archives
Sitemap
Blogroll OPML
Disclaimer

Powered by: newtelligence dasBlog 2.1.8102.813

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Send mail to the author(s) E-mail

Theme design by Jelle Druyts