To get started refactoring, may I suggest:
TestPassesBuilder.AppendFormat(
"<tr valign='top'><td><b>Subject</b></td><td>{0}</td></tr>",
MultipleTestPasses[i]["HasMultipleDataSet"][j]["subject"]
);
or
TestPassesBuilder.AppendFormat(
"<tr valign='top'><td><b>{0}</b></td><td>{1}</td></tr>",
"Subject",
MultipleTestPasses[i]["HasMultipleDataSet"][j]["subject"]
);
Where TestPassesBuilder
is of course a StringBuilder and MultipleTestPasses
has been converted to use appropriate generic collection types rather that ArrayList/HashTable abomination. The 2nd option will also allow the title for each row to be factored out into a variable at some point.
For the next step, MultipleTestPasses should be converted to a real object. Since it looks like he's using hard-coded keys, each 'key' really corresponds to a property of a class.