Below is a snapshot of the fitnesse code used to validate your
report.
Listing 1
public class fieldsinreport: ColumnFixture
{
public string fieldname;
public string datatype;
public Boolean ok()
{
CrystalReport1 report = new CrystalReport1();
foreach (CrystalDecisions.CrystalReports.Engine.ReportObject currentObject
in report.ReportDefinition.ReportObjects)
{
if (currentObject.Name == fieldname)
{
return true;
}
}
return false;
}
}
The code in listing 1 assumes that you have a report called
CrystalReport1 in an assembly somewhere. In our solution we have placed the
report in the namespace Eric.Landes.Sample.AutomateCRTest.TestingCR.
Notice that our fixture simply runs tests. The fixture is a
wrapper that runs basic functions needed to determine if your code can pass the
tests. For our report, iterate through the objects in CrystalReport1 to
determine if the current objects fieldname equals the fieldname in the report.
Let us look at the actual report to see what that means for the Crystal
Reporting side of things.