Friday, June 12, 2009
I am writing some tests for a project I am working on called Green Fee Broker.
The first thing I am doing is mocking the business layer for the WCF service that I am writing so I can inject it into the service’s constructor and write the service while isolating dependencies:
MockRepository mockRepository = new MockRepository();
IBookingManager manager = mockRepository.DynamicMock<IBookingManager>();
Next, I set an expectation that CreateTeeTime is called on the manager mock, which is injected into the service constructor:
Expect.Call(manager.CreateTeeTime(course, DateTime.Now)).Return(teeTimeStub);
Finally, I ReplayAll to record the mock, call the service and assert that I am getting back a TeeTime object:
mockRepository.ReplayAll();
BookingService service = new BookingService(manager);
TeeTime teeTime = service.CreateTeeTime(course, DateTime.Now);
Assert.IsTrue(teeTime.ConfirmationNumber == "ABC123");
Unfortunately, there is a bug in the line of code that sets up the expectation. With Rhino Mocks, for an expected behavior to be a match, the parameters must be an exact match. Notice the second parameter uses DateTime.Now. This means that the expectation will have a different parameter than the actual call, even if it is just a few milleseconds of a difference. As a result, the assertion will fail because the return is null.
The solution is to add the IgnoreArguments method call on the expectation:
Expect.Call(manager.CreateTeeTime(course, DateTime.Now)).Return(teeTimeStub).IgnoreArguments();
The IgnoreArguments() call will ensure that the parameters are discarded completely in determining a match.
Now I am green, and good to go!

Wednesday, June 10, 2009
I thought I’d post the model I created for my Desert Code Camp session “Building a Service-Oriented Application from the Bottom Up”.
The model is created with “M”, a new declarative language for building models in Microsoft Oslo.
As you can see, the domain is built around golf, or more specifically, managing bookings and tee times for a sample application called “Green Fee Broker”.
In this session, I will demonstrate how to compile the M model into Transact-SQL, and deploy it to the database. Next, with the logical schema out of the way, we’ll get started with the GreenFeeBroker service, a WCF 3.5 service that accepts booking requests from golfers on the internet looking for the best possible deal. Moving down the stack, we’ll use Entity Framework to model our conceptual entities and deliver at least one end-to-end slice of functionality using TDD.
Sunday, May 31, 2009
Please join my colleague, Todd Sussman and I on Wednesday, June 3rd as we share thoughts and best practices for delivering SOA to the enterprise.
In this 1 hour free webcast we will:
- Discuss the organizational, technical and political challenges inherent to distributing business processes across geographical business assets, vendors and business units of varying maturity.
- Provide insight and guidance directly from the field on how to bring business, technical and vendor teams together to achieve the shared vision and promise of SOA using state-of-the-art technology from Microsoft and the .NET partner ecosystem including specific discussions around WCF, Microsoft Business Rules Engine (BRE) and Neuron ESB.
- Provide real-world metrics from this success story that can be used to plan and measure success in your SOA initiatives.
Register here: https://www.clicktoattend.com/invitation.aspx?code=137585
I will be delivering my last free public class, "A Day in the Life of Scrum with Visual Studio Team System 2008 and Team Foundation Server" to Microsoft Phoenix next Tuesday, June 2nd.
There are still a few seats available, so feel free to register (please see invitation below with Invitation Key 4DEAA2). If you would be interested in a private class for your team or organization, please feel free to contact me for scheduling.

Please join Microsoft and Neudesic for a day in the life of Scrum with Visual Studio Team System 2008 and Team Foundation Server! Agile methods are a set of development processes intended to create software in a lighter, faster, more people-centric way. Many development teams have adopted "agile" methodologies to manage change and to improve software quality. These methodologies promote continuous integration as a practice to build and test software products incrementally as new features are included, bugs are fixed, and code is refactored.
If you missed the first series of Agile & Scrum Essentials last fall; here’s your chance to attend the follow-on event where we’ll briefly revisit the basics of Agile and Scrum and provide a walkthrough of how to configure Visual Studio Team System 2008 and Team Foundation Server for Scrum. Participants will be familiarized with how key artifacts are managed within this popular process template for enacting Scrum in organizations.
Join us for this interactive event as we explore a “day in the life of a Sprint,” that will give you a practical perspective of how Scrum teams leverage Visual Studio Team System for end to end management of the planning, execution and control of Scrum projects. The day will end with an overview of what’s coming in Visual Studio Team System 2010!
Register
Welcome: 8:30 PM
Seminar: 9:00 AM-4:30 PM

Phoenix, AZ
June 2, 2009
Click here to register or call 1.877.MSEVENT (1.877.673.8368) with invitation code: 4DEAA2.
Monday, May 18, 2009
I am thrilled to share that today, Monday, May 18th, the .NET Framework 4 Beta 1 will be available to MSDN Subscribers through MSDN Subscriber Downloads and to the general public on Wednesday, May 20th through Microsoft Downloads.
I have been fortunate to have my hands on a limited April CTP for some time now which is very close to what is included in Beta 1, so stay tuned for more information about VS 2010 and the WCF and WF enhancements in .NET 4.0 which are key areas that I will continue to focus on and share with you here.
Until then, here are some helpful links to get you started with NET FX 4.0:
Get the Bits
Learn What’s New
Get Support from the Community
Stay tuned for posts in the next couple of weeks that will address the significance of this major release, particularly around VS 2010 enhancements and Connected Systems framework technologies. Until then, if you haven’t already, please take the time to upgrade to .NET Framework 3.5 which will make sure your upgrade path to .NET 4.0 is as seamless as possible.
Saturday, May 16, 2009
I will be presenting a two-part session at Desert Code Camp 5 entitled "Building a Service-Oriented Application from the Bottom Up".
In Part 1 of I will demonstrate how to build a data model with "M" (a new, simple declarative language for building domain models and working with data that is part of the Oslo vision), and use Entity Framework to generate a conceptual data model and corresponding entities to build out our domain model. Next, I'll demonstrate Test-Driven-Development to implement a data access layer using LINQ to build CRUD methods for working with our model, wrap it in a business component and expose the application as a WCF service.
With the WCF service-oriented application completed in part 1 of this session, in Part 2 I'll demonstrate the implementation of a smart client application using the Model-View-Presenter (MVP) design pattern and implement the Gateway pattern in a service agent that will provide the communication infrastructure to the service we built in part 1. I'll demonstrate both BDD and TDD in working with the model, presenter and service agents.
Sound interesting? Then please, sign up for my talk!
http://www.desertcodecamp.com
See you at Desert Code Camp!
Monday, May 11, 2009
Thanks to all who came out for the Visual Studio Team System Big Event on Thursday, May 7th!
We had a great time with the Microsoft Developer Evangelist team, Microsoft Technical Specialists, MVPs and influencers who at the end of the full day of action packed training left no doubt that Visual Studio Team System is BIG!
Dan Weinman, Senior Consultant at Neudesic kicked off with the keynote on "Development Best Practices & How Microsoft Helps" and set the stage for what the day full of training had in store. Dan talked about the various roles that VSTS supports and how each role comes together to enact process under a single tool that maximizes transparency and communication on Agile teams.
Next, Brendon Birdoes, Principal Consultant at Neudesic delivered a great talk on
Test-Driven-Development with Visual Studio. Brendon covered unit testing, including test first development and showed off the refactoring capabilities right within the IDE along with code coverage. Brendon talked about how important code coverage and quality assertions are to ensuring that your unit tests are as useful as possible in maintaining high degrees of quality within your software projects.
Following the excellent session on TDD, Visual Studio Team System MVP Dave McKinstry delivered a session entitled ""It Works on My Machine!" Closing the Loop Between Development & Testing" which discussed the close integration between testing tools in Visual Studio Team System and the code itself which minimizes the cost and complexity in task switching.
We were then treated by another excellent talk by Rob Bagby, Developer Evangelist on "Treating Databases as First-Class Citizens in Development". In this session, Rob made clear that
database work can no longer hide from unit testing and how the Database Project in Visual Studio Team System makes synchronizing DDL and DML objects seamless and eminently testable.
I was lucky enough to show off the new Visual Studio Team System 2010 Team Architect bits which include fully compliant UML 2.1 diagram support as well as assembly, namespace, class and method visualization using the VSTS 2010 Architecture Explorer. I talked about VSTS 2010 Team Architect being yet another clear signal of Microsoft's commitment to modeling which is, and will continue to manifest itself in technologies like Windows Workflow, BizTalk Server, Entity Framework, and Quadrant to name just a few. As a Connected Systems guy, VS2010 Team Architect is really going to go a long way in helping me and my teams visualize the problem domain and partition our big balls of mud into the right architecture.
Speaking of which, I think my favorite new modeling feature in Team Architect is the Layer Diagram which lets you define your layers and then validate them at build time! What this means is that
I can use a layer diagram to define separation of concerns and single responsibility principle and then make sure that team members are honoring the layer rules. It is just awesome to be able to map namespaces to a layer diagram, wire it up to the automated build and keep violations from every being delivered.
The day winded up with a great talk by Steve Lange, Technical Specialist on how to get the most out of TFS. The session was aptly called "Bang for Your Buck" Getting the Most out of Team Foundation Server, and Steve gave away some great tips on things you can do with your investment in TFS that you may not have even known about.
I want to thank Steve and Rob for inviting us to speak at this event. The room was full of great folks with lots of passion and great questions which is exactly what we like to see at these events. If you have any follow up questions that I wasn't able to get answered at the event, please don't hesitate to contact me.
Thursday, April 30, 2009
In a conference call with Steven Martin yesterday, the head of the products division that includes .NET, Azure, IIS, ASP.NET, Dublin and Oslo shared some very impressive news.
Led by Greg Leake, a team of researches in the Microsoft Connected Systems Division set up two rigs in the lab. One was a 64-bit IBM WebSphere 7 Application Server running on an IBM Power 570 (IBM Power6/AIX 5.3 platform) and the other was a Hewlett Packard BladeSystem C7000 with Windows Server 2008 64-bit. Each were set up to run comparable versions of the Stock Trader reference application which has long been a reference standard for performance benchmarks.
In his paper, Greg compares the performance and price of these two IBM WebSphere platforms to the equivalent workloads developed using the Microsoft .NET Framework and deployed to the Hewlett Packard BladeSystem C7000 with Windows Server 2008 64-bit operating system.The results are astounding.
Of course, as you would expect, the ported version of the application, for .NET outperformed the J2EE/Websphere version by 57%, because it is no surprise that .NET is leaner and meaner than the Java platform, especially when it comes to distributed communication and Service Orientation leveraging WCF.
What is even more impressive, is that the IBM reference application, designed for Websphere runs 37% more efficiently on Websphere on Windows than Websphere on AIX! It gets better. The AIX rig, which Microsoft acquired on the regular market, retailed in at a total system cost of $215,000. This figure includes the IBM Power 570 hardware cost plus cost of
Websphere middleware.
The alternative? The platform that has long been regarded as inferior for large enterprise application scenario? The platform that has spanked the IBM equivalent by 57%? The Windows Server 2008 system, running HP BladeSystem C7000 has a total hardware cost of, wait for it… $50,161.That’s an 81% system cost savings for a configuration that outperforms the 6-figure-monster by 57%.
Now of course, this would be news in itself. But it doesn’t stop there. Greg’s group found that the identical reference application, deployed for Websphere on Windows Sever 2008 outperforms the IBM/AIX rig by 37%, and all for a 66% cost saving. The savings of course is reduced from the 81%, because unlike the Windows Platform, Websphere, well, isn’t free. Tacking $37,000 on for Websphere middleware licensing costs brings the Websphere on Windows system cost up to $87,161.
Now of course, the questions you have to ask, given this detailed information are the following:
- Why would you choose an inferior platform to run you mission critical enterprise applications when it underperforms when compared to an equivalent hardware and middleware configuration, especially when the IBM/AIX configuration costs 81% more?
- If you are running Websphere, why would you not opt to save 66% of your total system costs by moving to the Windows platform, especially if doing so would result in over a third better total application performance?
These are some big questions that Microsoft hopers Big Blue will attempt to answer.
In fact, Microsoft has prepared a site dedicated to informing and educating the industry on its findings: http://www.websphereloveswindows.com/
Now, while the performance benchmarks and cost savings speak for themselves, I have some breaking news. The report is flawed. Severely flawed. The report doesn’t speak to other costs such as administrative costs, maintenance or professional services. If you are an IBM/Websphere/AIX shop, you know too well how expensive keeping these systems running is. From tooling, to readiness, the Microsoft platform just has a far better story when it comes to administration and maintenance. And, if you’ve ever hired at Websphere consultant, you know what a bargain services from even a premier managed partner like Neudesic are.
References:
Tuesday, April 28, 2009
Ben Armstrong has saved us all several agonizing hours with this great, simple blog post about how to disable time synchronization in Virtual PC. In short, the process entails opening the .vmc file and updating the enabled flag to "false" within the host_time_sync element:
<host_time_sync>
<enabled type="boolean">false</enabled>
</host_time_sync>
Fortunately, disabling time synchronization in Hyper-V is as simple as clearing a check box. Right click the VM in question, select Settings, and choose Integration Services under Management. Next, simply clear the "Time synchronization" feature and hit OK:
When might you want to disable time synchronization? Ben's post got me out a bind once when doing a presentation on a VPC OS that was about to brick due to expiration lockout. Brian Keller, Developer Evangelist at Microsoft points out some tips for beating CTP expirations here. In my case, I converted the VS 2010 .NET 4.0 VPC to Hyper-V which Grant Holliday captures well here.
Of course, I do not recommend or advocate this as a means to cheat or steal, but it may come in handy should the process be sanctioned by the particular software vendor.
Hope this helps!
I recently uninstalled a certain productivity enhancement tool for VS 2008 which shall remain nameless because they are a good group of guys and have been very nice to me.
I uninstalled the tool, namely because I felt I was becoming a bit too dependant on it. Certainly, VS features like intellisense and basic refactoring support are not things I would willingly live without, but I feel that the features in VS are probably adequate for my needs and my IDE was starting to feel a bit clunky.
So, I uninstalled this tool, and immediately intellisense was missing. Anoying. I went into Tools->Options and re-enabled Intellisense. Life was good, or so it seemed.
For the last 5 weeks, the bane of my existence has been the fact that I couldn't set breakpoints in my code.
I could debug just fine if I right clicked + Breakpoints + Insert Breakpoint, or use F9, but when I tried to set the breakpoint on the left pane, as shown here, it just wouldn't work at all:
I was giving a class on TDD to one of my biggest customers today and in desperation, having right clicked + Breakpoints + Insert Breakpoint one too many times, I offered to buy lunch to the developer who could help me fix this. Now one developer offered the F9 option as workaround, which is better than a 3 step process, and this would have helped me out. Then, about 15 minutes later, another developer said they had the fix, and sure enough, he did!
The problem was that the "Indicator Margin" had been disabled. How did this happen? Why would this happen and what the hell is an Indicator Margin? Well, I don't have proof, but I am guessing that it is that "productivity" tool that did it when I uninstalled it.
The solution was simply to go into Tools->Options->Text Editor and enable Indicator margin as shown below:
I am forever indebted to this customer and am sharing this tip here in case this is driving you as nuts as it has me over the last month!