Wednesday, 14 May 2008

MS Test Re-Enabling Ignored Tests

In our current development environment we use MS Test for our unit testing and one thing that has been bugging me for a while is that if you remove the Ignore attribute from a test method, recompile and then try and run the test nothing happens and but you get a message in the status bar saying "No tests were run because no tests are loaded or the selected tests are disabled".

So I didn't really understand what that meant and usually ended closing Visual Studio, re-opening it and seeing if that fixed the problem, it didn't so I finally googled it and came across this MSDN article, in which it nicely explains that after adding the IgnoreAttribute to the unit test "The test is disabled. In the Properties window, the Test Enabled property is automatically set to False."

Now what should happen is when you remove the IgnoreAttribute the Test Enabled property is automatically set to True. However this does not seem to the case so after removing the IgnoreAttribute you need to either:

1. Open the Test View, select the ignored test, press F4 to display the properties window and set the Test Enabled property to True.

image

Or

2. Open the Test List Editor, selected the ignored test, right click and select "Enable" from the context menu.

image

I hope this helps anyone with future MS Test issues.

Tuesday, 22 April 2008

Automatic Properties and Structs

I was merrily creating my first struct since the advent of automatic properties and figured it would be nice and easy, so continued and created the following:

public struct UserNamePasswordPair
{
public string UserName { get; set; }
public string Password { get; set; }

public UserNamePasswordPair(string userName, string password)
{
UserName = userName;
Password = password;
}
}



To my disappointment I got a compiler error:



"The 'this' object cannot be used before all of its fields are assigned to"



This was very disappointing and I thought surely Microsoft wouldn't have forgotten to allow automatic properties on structs and it turns out they haven't, looking further down the error list I see a useful message:



"Backing field for automatically implemented property 'UserNamePasswordPair.UserName' must be fully assigned before control is returned to the caller. Consider calling the default constructor from a constructor initializer."



Ah ha, fair enough, so I simply added the call to the default constructor and bobs you uncle it compiled, yeh!



public struct UserNamePasswordPair
{
public string UserName { get; set; }
public string Password { get; set; }

public UserNamePasswordPair(string userName, string password)
: this()
{
UserName = userName;
Password = password;
}
}

Silverlight Assault Course - Bournemouth

Us guys at NxtGenUG - Southampton have been putting our heads together to create a complete day of Silverlight, we figured the best way to learn all this new technology is to get your hands on it and play with it whilst in the presence of people that know and can help answer your questions.  The great thing for me is that this event will be based in Bournemouth which is my home town!

Keep your eye on the NxtGenUG event list for more details on the final date of this. We are thinking that the day will consist of a bunch of hands on labs that give you some typical walk through scenarios allowing you to understand how things happen in Silverlight. There will also be key speakers that will deliver talks on the different aspects of Silverlight and how they fit within the current development world.

This is still in the planning stages but we are looking to get this all together within the next couple of months, I was just wondering whether anybody has some suggestions on the kind of content you would like in an event like this, please feel free to add comments with your suggestions.

Cheers

DDD7 - Date Released

I've now been given the nod that the date for DDD7 has been officially released, it is going to be Saturday 22nd November 2008 although the website hasn't been updated yet.

Saturday, 19 April 2008

Cool desktop switcher application

After the recent arrival of my new son Jacob, the inevitable huge amount of photos have been taken and my library has started to grow and grow. Now, it has always bugged me that the Windows desktop background image is static and you have to manually change it to something different when you 'feel the need', well this is no longer the case.

A friend pointed me in the direction of this handy little piece of software called John's Background Switcher by a guy called John Conners. It's got functionality to hook up to all sorts of online photo albums such as Flickr, Picasa, Phanfare etc and its really easy to use. Just point it at the albums you want to include, choose the type of background image you want (I really like the snap shot which creates a bunch of random polaroid looking images).

image

The following images I stole from John's site, which I am sure he won't mind because I am promoting his application, but they give you a good example of what the application does.

Make your wallpaper interesting!With John’s Background Switcher!

Anyone enjoy!

Friday, 18 April 2008

Now that was Entity-tainment

Last night saw another cracking NxtGenUG - Southampton user group session with a grand total of 36 attendees, the support we are receiving for the group is phenomenal and its going from strength to strength.

This was our first session after the arrival of British summer time and highlighted a small flaw in our venue which has glass walls on both sides which had the effect of bleaching out the early part of the session, but as the sun went down life was good again. If anyone knows where I can get hold of a large black cloth to drape over the windows I would be most grateful.

Neil Robbins, NxtGenUG Southampton member, kicked off the evening with a quick 10 minute walk through IIS 7.0 and permission controls, something useful to know about to let your local IT pro hand over permission to you as a developer when managing the IIS server remotely.

Mike Taulty then did a brilliant presentation, as we have come to expect from him, on ADO .NET Entity Framework. I always enjoy talks by Mike, he seems to have a way about him that keeps your interest all the way through the talk and continually provides the right level of technical content and humour ensuring an enjoyable session. For anyone that wants to check out the resources Mike mentioned in his talk have a look here.

I am personally really interested in the Entity Framework and I think it is going to have a big place in the development world in the future, I can't wait for future releases and to finally get my hands on the real thing.

Mid-way through the session we broke for the usual pizza and a quick chat. It was nice to see some new faces. 

Finally, the obligatory swag was distributed to the attendees, with swag ranging from a Tech Net baseball cap, Microsoft socks, a funky travel adapter, a really cool MSDN tool kit (it's a mini screw driver set that I personally think is really, really useful), the kind guys at JetBrains gave us another Resharper license to handout and last but by absolutely no means least a bunch of Visual Studio 2008 Standard Editions packs that were left over from our Install Fest Launch event last month, finally a whole bunch of T-Shirts were thrown out to the screaming masses.

All in all I think it was another successful event, many thanks to both Neil and Mike for the technical content and thanks to all the attendees for helping make Southampton the fastest growing NxtGenUG region!

P.S. If you did attend the event any feedback you have would be greatly appreciated, please go here to fill out your comments.

Thursday, 17 April 2008

Running WatiN with Cruise Control .Net

I've been doing a bit more work with WatiN lately to get some decent automated test coverage for our web application and everything was running all fine and dandy on my local machine (famous last words) but when the time came to move the tests into our continuous integration build environment I came across a bit of a problem, our cruise control runs as a service but WatiN launches IE, mmm a bit of a problem I think. Kicking off a cruise control build simply resulted in the build hanging for an extraordinary amount of time when the build previously took approximately 15 minutes.

So I did a bit of digging on the web and quickly came across a couple of people having similar issues, the first suggesting to simply set the "Allow interaction with the desktop" flag on the service, so I did this and tried again.

image

I restarted the service and kicked off another build and low and behold the tests started working, nice one.

Cheers