Fitnesse and C#

Here are some sample fitnesse tests and fixtures.

!define COMMAND_PATTERN {%m -r fitnesse.fitServer.FitServer,dotnet2fit.dll %p}
!define TEST_RUNNER {dotnet2Runner.exe}
!path C:developfitnessedotnet2fittestfittestbinReleasefittest.dll



|One|Two|a = One;b = Two;|

|check|together|Hello, World|

namespace fittest
public class OurFirstTest : fit.ColumnFixture
public string string1;
public string string2;
public string Concatenate()
return string1 + string2;

public class SecondTest : fit.ColumnFixture
public string a;
public string b;
public string c;

public string Output()
StringBuilder sb = new StringBuilder();

if (a != null) sb.AppendFormat(“a = {0};”, a);
if (b != null) sb.AppendFormat(“b = {0};”, b);
if (c != null) sb.AppendFormat(“c = {0};”, c);
return sb.ToString();

public class ActionFixtureTest : fit.Fixture
public string FirstPart;
public string SecondPart;
public string Together;
public void Join()
Together = string.Format(“{0}, {1}”, FirstPart, SecondPart);


vim searches

vim is a very powerful editor once you can remember a few command combinations.

The basic search is invoked with / (or ? if you want to go backwards).

Of late I have been using the character find command f (especially in visual mode, vf[char] is extremely useful as would yf[char].

For the uninitiated these select until the next character (or with y copy [yank] into the default buffer).

Yesterday I found in the help files the * and # commands.

* is search forward for the word under the current cursor (# is the backwards version).

Another useful option is t which searches for a character but stops one character before. So yt) will copy upto the next closing bracket or y2t) will copy til the second following bracket!

This is also useful for extracting the contents of a parameter list:


Enter visual mode, back one word go to matching brace, back one word then delete (and copy into default buffer).

This is a lightweight refactoring in itself.

FileHash generator to match silverlight manifest

The above is the source of the below code.  I needed to use this to check that the generated Hash used in a silverlight manifest was indeed correct.  One of my customers was having trouble installing on a win7 64 bit system.  This same build works fine elsewhere.  In the end we used a different whitelabel (same code different graphics and therefore checksums).

using System;
using System.Security.Cryptography;
using System.IO;

namespace FileHashSample
public class FileHash
public FileHash()

        public string ComputeHash(string filePath)
string filePathNormalized = System.IO.Path.GetFullPath(filePath);
SHA1 sha = new SHA1Managed();
FileStream fs = new FileStream(filePathNormalized, FileMode.Open, FileAccess.Read);
byte[] byteHash = sha.ComputeHash(fs);
return Convert.ToBase64String(byteHash, 0, byteHash.Length);

        public static void Main(string[] args)
if (args.Length == 0)
Console.WriteLine(“Please Enter a File Path”);
string filePath = System.IO.Path.GetFullPath(args[0]);
FileHash objFileHash = new FileHash();
Console.WriteLine(“File Path is {0}”, filePath);
Console.WriteLine(“File Hash is {0}”, objFileHash.ComputeHash(filePath));