Last active
August 29, 2015 14:07
-
-
Save joebuschmann/316119805f84f5f0b97f to your computer and use it in GitHub Desktop.
Binding example for limiting argument options to enum values
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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