Monday, May 25, 2009

Your First Concordion.Net Project (Part 2)

Setting Up Visual Studio

Part 1Part 3Part 4Part 5

If you’re a diligent .NET Developer then you have probably read Microsoft’s guidelines for setting up a Visual Studio project. If you have read this then I would also point you towards this excellent posting

Most Concordion.Net projects should follow the same basic structure of three assemblies:

  • <project-name> – the assembly containing your business logic
  • <project-name>.Test – an assembly for your unit tests
  • <project-name>.Spec – an assembly for your Concordion.Net specifications.

In our example we will be creating a project called Calculator. This will be a very simple project that contains only a calculator class API for others to use in their own code. Yes, I know this is a very simple example but it will have to do for now because I’m not feeling very imaginative! With Calculator we will have the following three projects:

  • Calculator
  • Calculator.Test
  • Calculator.Spec

Calculator.Sample.1

This will be the basic structure of our assembly. While I normally use xUnit for my open source projects I won’t be covering the Calculator.Test project much more than to say that you should have one there, it’s more for completeness.

We will talk about adding references later on as they’re required.

The ConcordionAssembly Attribute

One of the very first things you need to do on any Concordion.Net project is to mark your assembly with a ConcordionAssembly attribute. This allows Gallio (the thing that runs the specifications) know that this assembly contains Concordion specifications. If this attribute is not present then your tests will not be found. You can mark the assembly like this

[assembly: ConcordionAssembly]

place this declaration in the AssemblyInfo.cs file of the Calculator.Spec project.

The next part in this series will talk a bit about how to add specifications to the Calculator.Spec project.

1 comment:

  1. I added a small section at the end on the ConcordionAssembly attribute. Very important to place this in your assembly!

    ReplyDelete