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

!|Import|
|fittest|

!|fittest.OurFirstTest|
|string1|string2|Concatenate?|
|Hello|World|HelloWorld|

!|fittest.SecondTest|
|a|b|Output?|
|One|Two|a = One;b = Two;|

!|ActionFixture|
|start|ActionFixtureTest|
|enter|firstPart|Hello|
|enter|secondPart|World|
|press|join|
|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);
}

}
}

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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