Archive for May, 2010

Learn Windows Azure with Stanford’s Folding@home distributed computing project

 

Are you

A) a Scientist/researcher/student/ looking for the right enterprise platform for your next big scientific project?

B) a developer/architect who wants to learn cloud computing with windows Azure and would like to go beyond the Hello World Apps?

C) an hobbyist interested in Stanford’s Folding@home distributed computing project and see it’s implementation

D) someone who would like to try out a free two week trial of windows Azure and see a cool distributed computing project unfold (literally :) )

E) a combination of above

If your answer is anything from A-E, this is a perfect opportunity for you. @home with Windows Azure is an online hands-on workshop! This is a guided tour of process of building and deploying a large scale Azure application. No more “hello world”! in this two hour long session, you will see how to build and deploy a real cloud app that leverages the Azure data center It’s a free online session where each attendee will receive a temporary, self-expiring, full-access account to work with Azure for a period of 2-weeks.

The webcast is 2 hours and offered at 4 different times during the month of June.

For details, check out the project website and the event registration page.

You’d need VS.NET 2008/2010 with the Windows Azure Tools for Microsoft Visual Studio 1.1 (February 2010)

Enjoy!

PS. A recording of the Tuesday, May 4th session can be viewed along with the webcasts on Creating your first Azure application and Running and deploying the @home with Windows Azure application however in order to get the free 2 week account, you’d need to signup and attend an event.

Share

Upcoming SoCal .NET Events – June 2010

There are few upcoming events in Southern California I’d like to share.

On Thu, June 10th, Bart De Smet will be speaking to our own San Gabriel Valley .NET developers Group on Rx (Reactive Extensions). Bart is a Software Development Engineer on the SQL Cloud Data Programmability team, an avid blogger and a popular speaker on various international conferences. Rx is a technology created in the SQL Cloud Data Programmabiltity team. Details here.


June 26th and 27th, SoCal Code Camp in San Diego is on it’s way. This is going to be the  5th Code Camp event in San Diego. With great sessions and line of speakers, it’s a must-see-event for all SoCal developers.

On Wed June 2nd, Chris Burrows from Microsoft on the C# Compiler team will be speaking to a special Combined Orange County Meeting in Irvine on getting to Know C# 4. It’s part of the VS 2010 Launch Event with the Product Team at Microsoft Irvine Office. Details here

Woody Pewitt‘s just spoke to SGV.NET Users group on Mobile application development using .NET 4.0 last week. The recording of his talk is available here.

Last but not the least, Central Coast Code Camp Starts today.

Happy Coding!

Share

Mock Objects 101

Getting started with Mock Objects can be a bit daunting task if you are newly entering the uncharted waters of TLA’s i.e. TDD (test driven development). It quickly gets confusing to decide when to use Mock objects, the merit and need to use them and also how do they integrate with your testing strategy.

Let me give you a simplest example along with sample code of how to use MOQ, a simple and easy to use mock objects framework. This should help clarify some aspects of mock-objects and their potential usage.

Let’s say you have a simple Math class which looks like follows.

namespace MOQtester
{
   public interface IMathClass
   {
     int Sum(int a, int b);
   }

    public class MathClass : IMathClass
    {
        public int Sum(int a, int b)
        {
            return (a + b);
        }
    }
}

All it does is that it sums up two values and return you the response. Now you will try to mock it which means you’ll try to make a pretend-object or make-believe entity which will behave as the original object according to the instructions told during the setup.

Ok, what does this mean?

Here is all of this works.

You initialize a MOCK object class

var mock = new Mock();

and then you do the “setup” to instruct the make-believe object to return 10 when 1 and 10 are being summed up.

mock.Setup(s => s.Sum(1, 10)).Returns(10);

This setup (use to be Extend) instruction is very important because it defines the behavior of how the mock object would act when invoked.

Now one may wonder, why would I ever want to do this? Why can’t I just instantiate and run the original object?

Well, in this particular case you are right. Its easy to just instantiate an object of Math class and call the Sum method but imagine for the methods where this is hard for instance your HTTPContext testing or when you’d like to test a customer object without going to database and populating the entire thing for a selected test? You can think of several scenarios when a functionality like this can come in handy.

and this is how you’d call it

 mock.Object.Sum(1, 10)

Now I am returning a wrong value just to prove the point that mock objects are exactly what they are called, mock. This means they do as told and are not real replacements of original entities. They mock the supposed behavior of original entities and make TDD easier.

The entire listing of Program.cs looks like this

using System;
using Moq;

namespace MOQtester
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var mock = new Mock();
            mock.Setup(s => s.Sum(1, 10)).Returns(10);

            //Actual Object
            var obj = new MathClass();
            Console.Write("{0}, {1}", mock.Object.Sum(1, 10), obj.Sum(1, 10));
        }
    }
}

Complete Code can be downloaded from here. MOQ Sample Code

MOQ is a Mocking library for .NET 3.5 and C# 3.0, heavily based on Linq which can be downloaded from here.

Share
Go to Top