Skip to content

Instantly share code, notes, and snippets.

@adamralph
Created October 12, 2013 07:22
Show Gist options
  • Save adamralph/6946922 to your computer and use it in GitHub Desktop.
Save adamralph/6946922 to your computer and use it in GitHub Desktop.
xBehave DRY example
[Scenario]
public static void DoctorBillPostsToHisOwnBlog()
{
GivenIAmLoggedInAs("Dr. Bill", "oranges");
// When, Then...
}
[Scenario]
public static void GregPostsToAClientBlog()
{
GivenIAmLoggedInAs("Greg", "apples");
// When, Then...
}
private static Fluent.IStep GivenIAmLoggedInAs(string username, string password)
{
return string.Format("Given I am logged in as {0}", username)
.Given(() => Site.Login(username, password));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment