I've been testing out Concordion.Net, and looks great. I came up with an issue when executing multiple datasets in a table. Basically, I have an input variable called 'isClosed' set as a boolean. When set as boolean, this outputs an error in the test as per below:
The <table> 'execute' command only supports rows with an equal number of columns.
If instead of boolean I use an string, and then for example I compare to a value of "Y" (isClosed == "Y"), it works fine.
Attached you can find a zip file with two very similar tests.
- MakingABooking_usingBools: The test which fails, which uses booleans
- MakingABooking_usingStrings: The test which works.
As you can see, both are using very similar data.
Specification and code is copied below for convenience.
Specification
<!DOCTYPE html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<style type="text/css">
.auto-style1 {
width: 345px;
}
</style>
</head>
<body>
<h2>Booking 2.1</h2>
<p>
A booking can be made by a customer, at a specific time, for an amount of covers.
</p>
<p>
The restaurant must have enough space at that particular time. Also, that particular time must not be closed
</p>
<p>
<table concordion:execute="#result = MakeBooking(#totalCovers, #coversRemaining, #isClosed)" style="width: 100%;">
<tr>
<th>Comment</th>
<th concordion:set="#totalCovers">Total Covers</th>
<th concordion:set="#coversRemaining">Remaining covers booked in all restasurant</th>
<th concordion:set="#isClosed">closed</th>
<th concordion:assertEquals="#result.canBook">can book</th>
<th concordion:assertEquals="#result.remainingCovers">remaining covers booked in all restaurant - after</th>
</tr>
<tr>
<td>Not enough remaining covers</td>
<td>6</td>
<td>5</td>
<td>n</td>
<td>N</td>
<td>5</td>
</tr>
<tr>
<td>Enough covers and open</td>
<td>8</td>
<td>12</td>
<td>N</td>
<td>Yes</td>
<td>4</td>
</tr>
<tr>
<td>enough covers but closed</td>
<td>8</td>
<td>12</td>
<td>Y</td>
<td>false</td>
<td>12</td>
</tr>
<tr>
<td>not enough covers and closed</td>
<td>6</td>
<td>5</td>
<td>true</td>
<td>No</td>
<td>5</td>
</tr>
</table>
</p>
</body>
</html>
Failing Code
public Result MakeBooking(int totalCovers,
int remainingCoversBookedInAllRestaurant,
bool isClosed)
{
//given
RestaurantTimeInfo timeInfo = new RestaurantTimeInfo();
timeInfo.RemainingCovers = remainingCoversBookedInAllRestaurant;
timeInfo.IsClosed = isClosed;
//when
var result = checkIfCanBook(timeInfo, totalCovers);
//then
return result;
}
Working Code
public Result MakeBooking(int totalCovers,
int remainingCoversBookedInAllRestaurant,
string isClosed)
{
//given
RestaurantTimeInfo timeInfo = new RestaurantTimeInfo();
timeInfo.RemainingCovers = remainingCoversBookedInAllRestaurant;
timeInfo.IsClosed = strToBool(isClosed);
//when
var result = checkIfCanBook(timeInfo, totalCovers);
//then
return result;
}
Any ideas?