Yesterday I wrote six lines of code.  Seven if you count the connection string. These are them:

// Retrieve storage account from connection string.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));

// Create the queue client.
CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();

// Retrieve a reference to a container.
CloudQueue queue = queueClient.GetQueueReference("formsservicequeue");

// Create the queue if it doesn't already exist

// Create a message and add it to the queue.
CloudQueueMessage message = new CloudQueueMessage(urlEncodedXmlFormData);


I say wrote, what I actually did was copy and paste from the MSDN documentation and make a small change.

The rest of the day was spent figuring out which particular combination of NuGet package and Azure Storage Emulator would work with the old code this was added to and how to add unit tests around it.

In the end I gave up on unit tests and just did some manual integration testing as the original code never had unit test written, is integrated with Dynamics CRM 4.0 Organisation, Discovery and Metadata services, is itself an old SOAP service and is scheduled for replacement in the next few months.

The amount of work required to separate the components, write fakes for all the services and add in dependency injection is just not worth the benefit in this particular case.


Author: Stuart

Crazy Person

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s