Links from .NET Developer Network session on Azure


Note: Cross posted from IUpdateable from Eric Nelson.

Permalink

A big thanks to everyone who came along last night (Feb 25th 2010) to the .NET Developer Network and to Guy for inviting me along and being a great host.

I had lots of fun and enjoyed it being so interactive.

As promised, some links relevant to the conversations during the evening and the many questions. I will also do a post on Monday summarising the many “limits” we discussed on instances, roles etc:

Tools:

And the offers:

And finally, the 4 minute video you can point colleagues at :-)

Jesse Liberty Silverlight Tour of the UK and Ireland in April


Note: Cross posted from IUpdateable from Eric Nelson.

Permalink

I was presenting at the excellent .NET Developer Network in Bristol last night run by the awesome Guy Smith-Ferrier. Guy reminded me of this awesome news which needs broadcasting widely – Jesse Liberty is in town in April. Sweet.

Stolen directly from Guys post:

Jesse Liberty, Silverlight Geek (Microsoft US Developer Evangelist for Silverlight), is doing a tour of the UK and Ireland in April to coincide with Microsoft UK’s week of TechDays (#techdays) events. Jesse is speaking at Bristol, London, Cambridge, Leeds, Newcastle, Edinburgh, Glasgow, Belfast and Dublin between Monday 12th April 2010 and Friday 23rd April 2010. You can match the dates to the venues at Jesse’s post. Jesse’s first stop on the tour is at The .NET Developer Network on Monday 12th April 2010 where we will also be celebrating our third birthday (with cake!). Jesse will be presenting:-

  • Silverlight 4, MVVM and TDD: A Brave New World (level 300)
    1.       MVVM and Silverlight to build test-driven programs
    2.       Understanding Refactoring and Dependency Injection
    3.       A Walk through of a non-trivial application

You can sign up for this one here. Thanks to Microsoft (US, UK, ROI) and UGSS for sponsoring this tour and making it possible”

The content looks very good – and the cake in bristol on the 12th is tempting if I’m not in London that day for the free Microsoft Tech Days.

Introduction to Application Development With Silverlight 4 

This presentation is targeted at .NET programmers new to Silverlight or who wish a review of the fundamentals of building an application in Silverlight 4. Topics will include

  • Drag and Drop development
  • Xaml and Code
  • Layout and Controls
  • Data, Data-binding, Validation and Async-validation
  • Templates and The Visual State Manager (Time allowing)

Building A Highly Extensible, Decoupled Silverlight Open Source Application with MEF and RIA Services using Lean, Test Driven Development, An International Team of Volunteer Programmers,  and lots of Advil.

This talk will use the Silverlight HyperVideo Platform open-source project on CodePlex as a case study in building highly extensible Silverlight applications. Among the topics we will focus on are:

  • New features in Silverlight 4 and how they made life easier
  • The Managed Extensibility Framework (MEF) added to Silverlight 4
  • WCF RIA Services for connection to a back-end db
  • Handling inter-module communication when the requirements are that modules cannot assume which other modules will be created, there can be no dependencies on order-of creation and unanticipated modules must be able to communicate with existing modules.
  • Using Markers, Injected Markers and polling to trigger events while viewing a video.
  • A Quick introduction to Lean, TDD and Kanban

Silverlight 4,  MVVM and Test-Driven Development
  • MVVM and Silverlight to build test-driven programs
  • Understanding Refactoring and Dependency Injection
  • A Walk through of a non-trivial application

Q&A: How do I find out the status of the Windows Azure Platform services?


Note: Cross posted from IUpdateable from Eric Nelson.

Permalink

The Windows Azure Platform includes a status dashboard as well as RSS feeds for individual services and regions.

You get to see the current status:

image

As well as the history of an individual service:

image

As I’m based in the UK, I subscribe to the North Europe feeds for each of the services:

Related Links:

Windows Azure Portal surfaces the relationship between billing and deployed


Note: Cross posted from IUpdateable from Eric Nelson.

Permalink

I previously posted on when you get charged with Windows Azure as it is contrary to many folks expectations. Today (25th Feb 2010) I was pleased to see a new warning on the portal.

Note that you only need to delete the deployment not the service. And to delete you must first stop it.

Well done team.

image

Related Links:

I have a funny feeling this actually reflects my life at the moment


Note: Cross posted from IUpdateable from Eric Nelson.

Permalink

Every so often I Wordle my delicious account to see “where I’m at”. This is a spookily accurate depiction of my online life at the moment :-)

image 

Therefore…

Related Links:

:-)

Visual Studio 2010 Conversion Wizard and Azure solutions – do not change target to .NET 4


Note: Cross posted from IUpdateable from Eric Nelson.

Permalink

I am currently (Feb 2010) moving lots of Azure samples originally built in Visual Studio 2008 to Visual Studio 2010 RC. I just realised there is a simple mistake folks can fall into. Easy to do, easy to avoid.

When opening an Azure solution originally built in Visual Studio 2008  you will see the Conversion Wizard.

image

Once you click Finish you will see this dialogue box with a default of Yes. Do not click Yes! Instead click No.

image

The reason is simple. As of Feb 2010 the Windows Azure Fabric in Microsoft Data Centres is not running the .NET 4.0 RC, it is instead running .NET 3.5 SP1. Therefore you want to stick with .NET 3.5 SP1 for your projects to get the equivalent experience with the development fabric – which means you won’t have access (just yet) to some of the really good stuff such as Entity Framework 4.

End result is a nicely converted solution.

image

Related Links:

In person events Feb through April 2010


Note: Cross posted from IUpdateable from Eric Nelson.

Permalink

Just a brief note about events where you can expect to see me over the next few months in the UK (and TBH this post will be helpful reminder to me!)

February

March

April

Should keep me out of mischief :-)

FREE Microsoft UK Tech Days April 12th to 16th in London, including Windows Phone 7


Note: Cross posted from IUpdateable from Eric Nelson.

Permalink

image

While I was on holiday last week we announced Tech Days. Tech Days is shaping up to be something rather good. It is a week-long series of free events run by Microsoft and technical communities to

“Celebrate and inspire developers, IT professionals and IT Managers to get more from Microsoft technology”  

You can attend for 1 day or all 5 days. You can just attend the developer days or mix it up with the IT Pro days. It is entirely up to you.

I will be doing my bit delivering sessions on Azure, Entity Framework 4 and Parallel. I hope to see you there.

Register now at http://www.microsoft.com/uk/techdays.

Developer Days – Fulham Vue Cinema:

Monday, 12 April 2010: Microsoft Visual Studio 2010 Launch – A Path to Big Ideas

This launch event is aimed at development managers, heads of development and software architects who want to hear how Visual Studio 2010 can help build better applications whilst taking advantage of great integration with other key technologies.

NB – Day 2 will cover the technical in-depth sessions aimed at developers

Tuesday, 13 April 2010: Getting started with Microsoft .NET Framework 4 and Microsoft Visual Studio 2010

Microsoft and industry experts will share their perspectives on the top new and useful features with core programming languages and in the framework and tooling, such as — ASP.NET MVC, Parallel Programming, Entity Framework 4, and the offerings around rich client and web development experiences.

Wednesday, 14 April 2010: The Essential MIX

Join us for the Essential MIX as we continue exploring the art and science of creating great user experiences. Learn about the next generation ASP.NET & Silverlight platforms that make it a rich and reach world.

Thursday, 15 April 2010: Best of Breed Client Applications on Microsoft Windows 7

Windows 7 adoption is happening at a startling pace. In this demo-driven day, we’ll look at the developer landscape around Windows 7 to get you up to speed on the operating system that’ll your applications will run on through the new decade.

Friday, 16 April 2010: Windows Phone Day

Join us for a practical day of detailed Windows Phone 7 development sessions covering the new Windows Phone specification, application standards and services

GuesPost: Typemock Isolator – Much more than an Isolation framework


Note: Cross posted from IUpdateable from Eric Nelson.

Permalink

This is the second guest post from Gil Zilberfeld who works at TypeMock and kindly agreed to do a couple of guest posts on Mocking . The first was an Introduction to Mocking.

Typemock Isolator – Much more than an Isolation framework

image

In my last post, I showed how to fake a dependency. But this involved doing a couple of things. First, it involved changing the original method. Then, I had to write wrappers (a real wrapper and the fake wrapper) and finally, I had to inject the fake object in the test. This is a lot of work, even for a very simplistic example. The solution for that is an isolation framework.

Isolation frameworks isolate the code from their dependencies, but they do it programmatically, and without hassle. What makes Typemock Isolator 2010 different than other frameworks (like Rhino Mocks and Moq) is that you don’t need to change the tested code just to test it.

Let’s look at the test we got last time – using a fake Message Queue to test that the message was called:

[TestMethod]
public void Send_StringMessage_MessageWasSent()
{
    var fakeQueue = new FakeMessageQueue();

    var server = new Server();
    server.SendMessage(fakeQueue, "message");

    Assert.IsTrue(fakeQueue.messageWasSent);
}

We’re actually doing two things in this test with our fakeMessageQueue object. The first is changing behavior – the SendMessage method does not call the original SendMessage method. The second is testing that the method was called. We do this by using a public field in the fake object.

We can accomplish the same things much easily with Typemock Isolator. Let’s go back to the original method, before we changed it:

public class Server
{
    public void SendMessage(MessageQueue queue, object message)
    {
        queue.Send(message);
    }
}

With Isolator, the test would look like this:

[TestMethod]
public void Send_StringMessage_VerifyMessageWasSent()
{
    MessageQueue fakeQueue = Isolate.Fake.Instance<MessageQueue>();

    var server = new Server();
    server.SendMessage(fakeQueue, "message");

    Isolate.Verify.WasCalledWithAnyArguments(() =>fakeQueue.Send(null));
}

As you can see, there are a couple of changes. The first is the Isolate.Fake.Instance statement. It creates a fake MessageQueue object. This is the original MessageQueue type; only method calls on it are ignored when they are called. So when the server calls the Send method on the fakeQueue it is ignored.

The other half of the equation is to verify that the method was called. Instead of planting a field to save the result, we use the Isolate.Verify API to test that the method was called. We don’t care about arguments sent to the method, so we put null in the argument, just to keep the compiler happy.

This is the basic stuff. What really separates Isolator from the rest is that Isolator can change and verify method calls on any method: Static and sealed classes (like the “untestable” SharePoint).

And it can change objects in mid-run. Let’s say my method under test looks like this:

public void SendMessage(object message)
{
    MessageQueue queue = new MessageQueue(@".\myQueue");
    queue.Send(message);
}

This time the MessageQueue is created inside the method under test! But Isolator can help here as well:

[TestMethod]
public void Send_StringMessage_VerifyMessageWasSent()
{
    MessageQueue fakeQueue = Isolate.Fake.Instance<MessageQueue>();
    Isolate.Swap.NextInstance<MessageQueue>().With(fakeQueue);

    var server = new Server();
    server.SendMessage("message");

    Isolate.Verify.WasCalledWithAnyArguments(() =>fakeQueue.Send(null));
}

Notice the Swap.NextInstance call? It replaces the next time a MessageQueue is created. And that exactly happens inside the method under test.

Typemock Isolator has lots of other capabilities that make it easier to write tests– like recursive fakes (the ability to create a full object tree of fakes in a single line) and Intellitest, auto completion for testing statements.

But don’t take my word for it. Take Isolator for a ride – it’s about easy unit testing.

Gil Zilberfeld

Technology Evangelist | TypemockBlog | Twitter

GuestPost: Introduction to Mocking


Note: Cross posted from IUpdateable from Eric Nelson.

Permalink

I have previously posted on the area of Test Doubles and Mocking under the guise of Project NEric. I also have blogged on specific tools such as Pex and TypeMock – but I wouldn’t claim to be an expert on the area. Far from it.

Luckily I know a man who is. Meet Gil Zilberfeld who works at TypeMock and kindly agreed to do a couple of guest posts on Mocking. This is the first of those two. I should get the second online next week when I return from holiday.  Thanks again Gill.

Introduction to Mocking by Gill Zilberfield

image

It was about 4 years ago, when I decided to try TDD (Test Driven Development). I was a project manager at the time, and I had a rule – never test anything on your team, before you try it (on) yourself. I was writing a communication server at the time, and thought – hey, why not?

Starting was easy. I added a couple of interfaces, checked that the object is created correctly. And then I got to the heart of the matter – the component used MSMQ as a messaging infrastructure. Sending a message to the queue was easy. Checking that it got there – well that’s another story.

My success for criteria for my test for sending a message was to check that the message arrived. And it arrived. Sometimes before the test ended (success) and sometimes after (failure). You see, MSMQ has a mind of its own (also known as asynchronous behavior). I couldn’t control its behavior, so I had to replace it with another object I could control. This was my first mock object.

Mocking is generally an overloaded term. But at its base – it’s about changing behavior. Which behavior? Dependency behavior.

Let’s look at my class:

public class Server
{
    public void SendMessage(IMessageQueue queue, object message)
    {
        queue.Send(message);
    }
}

I need to send the message to the queue. But, like I said, queue (which is the dependency of Server) sometimes behaves funny. And we don’t like funny, we like dependable. Let’s change the signature a bit:

public class Server
{
    public void SendMessage(IMessageQueue queue, object message)
    {
        queue.Send(message);
    }
}

This time, I’m not sending a MessageQueue object. Instead, I’m sending the IMessageQueue interface, which looks like this:

public interface IMessageQueue
{
    void Send(object message);
}

Now that I can inject any object implementing the IMessageQueue interface. For example, my real Message Queue object looks like this:

public class RealMessageQueue : IMessageQueue
{
    var queue = MessageQueue.Create("AnyQueue");

    public void Send(object message)
    {
        queue.Send(message);
    }
}

But another, a fake message queue object can look like this:

public class FakeMessageQueue : IMessageQueue
{
    public bool messageWasSent = false;
    public void Send(object message)
    {
        messageWasSent = true;
    }
}

As you can see, with the FakeMessageQueue, I can actually test that the message was sent:

[TestMethod]
public void Send_StringMessage_MessageWasSent()
{
    var fakeMessageQueue = new FakeMessageQueue();

    var server = new Server();
    server.SendMessage(fakeMessageQueue, "message");

    Assert.IsTrue(fakeMessageQueue.messageWasSent);
}

And that’s the whole idea behind mocking – the ability to change behavior. This is a very tiring way to do that. Today, there are tools to do the same thing, with much less hassle: Isolation frameworks. In my next post, I’m going to talk about one of them: Typemock Isolator.

Gil Zilberfeld

Technology Evangelist | TypemockBlog | Twitter