Skip to content

Instantly share code, notes, and snippets.

@marcusoftnet
Created April 25, 2011 19:45
Show Gist options
  • Save marcusoftnet/941065 to your computer and use it in GitHub Desktop.
Save marcusoftnet/941065 to your computer and use it in GitHub Desktop.
Dead-simple usage
public class ActivityDbEntity
{
public string Heading { get; set; }
public string NumberOfHours { get; set; }
public string Date { get; set; }
public string Coach { get; set; }
public string Customer { get; set; }
}
[Given(@"the that the following activity is in the database")]
public void CreateActivity(Table table)
{
/*
* Scenario: Delete activity without hesitation
Given there are no activites for coach 'Test Coach' in the database
And there is a coach named 'Test Coach' in the database
And there is a customer named 'Test Customer' in the database
And the that the following activity is in the database
| Heading | NumberOfHours | Date | Coach | Customer |
| Activity to delete | 12 | 2011/01/01 | Test Coach | Test Customer |
And I am on the 'Activities' page
When I delete the activity with heading 'Activity to delete' and confirm it
Then I should be on the 'Activities' page
And 1 activity with the heading 'Activity to delete' should be in the activities list
* */
// Now I do this
var row = table.Rows[0];
var act = new ActivityDbEntity
{
Coach = row["Coach"],
Customer = row["Customer"],
Date = row["Date"],
Heading = row["Heading"],
NumberOfHours = row["NumberOfHours"]
};
DbHelper.CreateActivity(act);
// But I want to do this instead.
// That gives me "Could not find column"
//DbHelper.CreateActivity(table.CreateInstance<ActivityDbEntity>());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment