Arrange, Act and Assert syntax for testing

This post is a summary of a lightningtalk I held for some of my colleagues at Objectware back in August 2008.

What is Arrange, Act, Assert (AAA)?

AAA is a way to organize your tests. The contents of the tests are divided in to three parts:

  1. Arrange: Do the necessary setup required for running the test. Usually multiple lines of code.
  2. Act: Execute the code which should be tested. Should be one line of code.
  3. Assert: Verify that the code behaved as expected. Should contain only one assertion.
Example of a test without AAA

The same test written in AAA style:

The example above is simple, but the value of using AAA style becomes more apparent for complex tests.

Why using AAA syntax

AAA and mocking

In the following example, which parts of the code are arranging, acting and asserting?


The record/playback style should not be used, since it results in tests which are very hard to read and understand.

The same test as above written in AAA style:

Mocking frameworks supporting AAA syntax

The following mocking frameworks supports AAA:

  • NSubstitute
  • Rhino Mocks 3.5
  • Moq
  • Typemock Isolator 5.0

LEAP part 1

About LEAP

Earlier this week I attended the first out of five classes of Microsoft’s new Lead Enterprise Architecture Program (LEAP). The goal of LEAP is to educate a group of Microsoft partners and system integrators on the Microsoft platform. During the spring, 5 Master Class training sessions will be held at Microsoft’s office in Oslo, and in June LEAP participants from all over the world will meet for one week in Redmond, Seattle.

This is the first time LEAP is organized in Norway, and if successful, it probably will be repeated later on.

The first master class

The topic of the first master class was N-tier and N-layer architecture and the class had about 40 participants.

Fortunately, Microsoft did not just give a presentation in the traditional drag and drop create-an-application-in-five-minutes style. Instead, the well known software architect Jimmy Nilsson had been engaged to run the show. He’s best known for being the author of the excellent Applying Domain Driven Design and Patterns.

Instead of focusing on products, he advocated Test Driven Design/Development, Domain Driven Design, code quality and object orientation. Much of the time was spent on group discussions.

The following topics were covered:

  • Layering
    • Focus on the Domain Model pattern
  • Data access
    • O/R mapping, entity framework
    • Suggested to use EF POCO Adapter for those who would like to start using Entity Framework v1 and have a migration path to EF v2
  • UI patterns
    • MCV, MVP, MVVM
  • Case study
    • Worked together in groups to suggest the most appropriate architecture for a specific case

Mounting ISO images in Windows 7 beta 1

Yesterday I installed Windows 7 beta 1 on the laptop which I use for training.

My employer provided me the Visual Studio installation CD as an ISO image, but when I got to the stage of installing it, I discovered that none of my regular ISO mounting tools (like DEAMON Tools) worked on Windows 7.

Fortunately, I found this small, non-intrusive and free mounting tool called Prismo File Mount. It installed in a second, and is really easy to use.


Using “Quick mount” on the ISO file transformed it into a browsable directory from which I could install Visual Studio, similar to the Compressed Folders shell extension for zip files built into Windows Explorer.

Using the “Mount…” option, it is possible to map the image as a drive, if desired.

UPDATE: Prismo File Mount does not work for 64-bit editions of Windows 7. MagicDisc is a good free alternative in case you are running 64-bit Windows 7.

My podcast subscriptions

Podcasts are a great way to keep yourself updated on topics of your interests. I usually listens to podcasts when sitting on the bus back an forth between home and work and when exercising at the fitness centre.

For .Net developers, there exists several good podcast publishers. My favourites audio podcasts are:

I’m also subscribing to a few non- .Net podcasts. For these ones, I put some more efforts into filtering out non-relevant shows.