Deliberating On Software Development

March 7, 2010

Your First Concordion.Net Project (Part 4)

Filed under: Uncategorized — x97mdr @ 9:46 am

More Specifications!

Part 1Part 2Part 3Part 5

In the previous post we got our project set up and added the first specification.  The sad part was it didn’t really do much.  It only acted as a gateway into our other specifications.  Let’s add something a bit juicier!

In the gateway specification document (Calculator.html) we put a link to an Operations.html specification.  Let’s add that now.  Remember to add the .html and class file then set the properties on the .html file as per the gateway specification and set up the fixture just like the CalculatorTest class.


The content of Operations.html should resemble this when finished


Now we have a document describing the various operations that we can perform.  So let’s add two more specifications: one for the arithmetic and one for the trigonometric.  Your project should now look like this:


Did you remember to set the .html and .cs files up like the others? I hope so … otherwise you’re in for some heartache 🙂

Arithmetic Operations

Let’s add some basic arithmetic operations to our specification: addition, subtraction, multiplication, division.  The specification file is much like our other specification files excepting that it now contains some special markup.  Here is an excerpt from the page’s Multiplication example:

<h3>Example – Multiplication</h3>

    The result of <b concordion:set="#firstOperand">2</b> * <b concordion:set="#secondOperand">2</b>

    the result will be:
    <b concordion:assertEquals="Multiplication(#firstOperand, #secondOperand)">4</b>

The rendered html file will resemble this:


You can see the source in the included project but the items to note are the concordion:set and the concordion:assertEquals attributes.  concordion:set is used to set a value of a public field or property in the fixture class.  The assertEquals checks the value in the element (the expected value) against the value returned by the operation defined in the concordion:assertEquals attribute.  It is the concordion:assertEquals that will actually turn red or green (maybe yellow, but hopefully not yellow … cross your fingers!)

Creating the fixture

Now that we have a specification, we need some code in the fixture to back it up!  So let’s add some.  Note that this code is going to fail.  True TDD practitioners follow the red-green-refactor methodology so we will try and follow suit.  Our fixture code will look like this:

public class ArithmeticTest
    public long firstOperand;
    public long secondOperand;

    public long Addition(long first, long second)
        return -1;

    public long Subtraction(long first, long second)
        return -1;

    public long Multiplication(long first, long second)
        return -1;

    public long Division(long first, long second)
        return -1;

We should now have a complete fixture that should be able to run, albeit with some errors!

Next time we will work on how to run your project with Gallio and produce some results so that we can refactor the above code and turn it into something more meaningful!


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a free website or blog at

%d bloggers like this: