Skip to content

Instantly share code, notes, and snippets.

@joebuschmann
Last active August 29, 2015 14:07
Show Gist options
  • Save joebuschmann/316119805f84f5f0b97f to your computer and use it in GitHub Desktop.
Save joebuschmann/316119805f84f5f0b97f to your computer and use it in GitHub Desktop.
Binding example for limiting argument options to enum values
[When(@"I sort by product name (ascending|descending)")]
public void WhenISortByProductName(SortOrder sortOrder)
{
_products.Sort((s1, s2) =>
{
if (sortOrder == SortOrder.Descending)
return s1.ProductName.CompareTo(s2.ProductName) * (-1);
return s1.ProductName.CompareTo(s2.ProductName);
});
int i = 1;
_products.ForEach(p => p.Index = i++);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment