Torbjörn Nomell’s blog

View Torbjörn Nomells profile on LinkedIn

Written by: Torbjörn NomellCQRS
CQRS Journey on MSDN

Guidance by Microsoft patterns & practices has been released and it looks promising.

The foreword is written by Greg Young who is to consider a celebrity in the CQRS world, so it looks like Microsoft and the patterns & practices team did a great job. I'll have some busy nights in head of me to read this guidance.

Another exiting project by Microsoft is the Service Bus (1.0 Beta, at the moment).

Since CQRSarchitecture is gaining, the use of service buses will grow over the next yearsand it's great that Microsoft is in the game.

Write new comment

Written by: Torbjörn NomellWeb
Lovely news in ASP.NET 4.5

Went to a seminar in June about the news in MVC4.

Well, some nice features were added to this release like bundling and minification but what I'm really been waiting for is:

Support for WebSockets Protocol!

Yes, it's true, ok we need IIS 8 but let's start build instant updating apps. When I was learning HTML 5 Web Sockets I down loaded a couple of web socket server console host implementations. But I could not publish anything to my web hotel because it only supports IIS. Also, customers I working for prefer IIS host applications.

Next problem, browser support...

Write new comment

Written by: Torbjörn NomellTDD
Enhance unit tests by checking coverage

When adding unit tests it can sometimes be hard to get an overview of how much code is covered, especially when adding tests to existing code.
Why not try a code coverage tool? I tried PartCover, it's free and open source software. Here's how to use it with Nunit.

• Click File -> Run target
• Edit settings

• Executable file: Full path to nunit-console.exe
• Working directory: Path to NUnit directory
• Working arguments: Path to test assemblies, delimited by spaces, DON’T forget /noshadow flag (to get source code from NUnit)
• Rules: Specify Assemblies to test and Namespaces eg. +[Assembly]Namespace (Start with +[*]* to get everything)
• Don't forget to save settings when satisfied
• Start
• Wait
• Browse the resulting tree
• Click Views -> View coverage details to see source code

 .NET 4? Be aware!
If your test assemblies are compiled for .NET 4 then things might not work.
That’s because NUnit doesn't support .NET 4 by default(?). I had to add the following to nunit-console.exe.config
 <requiredRuntime version='v4.0.30319' />

Coverage != Quality
Just remember that good code coverage cannot be interpreted as good quality of unit tests and the aim of 100% coverage have several drawbacks.

Write new comment

Written by: Torbjörn NomellTDD
Test all C# enum values with NUnit

I just tried to find a nice way to test all combinations of input parameters to a test case where one of the parameters is a C# enum. The thing is that I don't want to test the current range of enums but also those added in future. I found a blogpost about how to solve this with the TestCaseSource attribute. ValuesSource attribute could also be used if there are more input parameters to test. But the nicest way I could find out to do this was to extend NUnit with a new attribute.

[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)]

public class EnumValuesAttribute : ParameterDataAttribute


  protected System.Collections.ICollection data;

  public EnumValuesAttribute(Type anEnum)

  { = Enum.GetValues(anEnum);



  public override System.Collections.IEnumerable GetData

    (System.Reflection.ParameterInfo parameter)





Now our tests can look like this:


public void Test(

  [EnumValues(typeof(MyEnum))]MyEnum val,

  [Values(true,false)]bool isNewUser)




Write new comment

Written by: Torbjörn Nomell.NET

Had the opportunity to hear Udi Dahan and Andreas Öhlund talk about NServiceBus last week. To really understand what NServiceBus is all about I think I’ll have to download it and fiddle with it or maybe read some more blog posts. What I did understand that it’s a really cool architectural component that can simplify and enhance the systems we build. Not to mention sagas, which I have to dig in to a lot deeper. Udi is a good speaker and he can really captivate the audience.

Write new comment

TalkActive Blog - Copyright 2017 - Talkactive ApS - all rights reserved.