public void WithFilterOptions_SetsOptions()
        {
            IEnumerable <SelectListItem> expected = new SelectListItem[0];
            IEnumerable <SelectListItem> actual   = column.WithFilterOptions(expected).Filter.Options;

            Assert.Same(expected, actual);
        }
Esempio n. 2
0
        public void WithFilterOptions_SetsDefaultFilterMethod(String current, String method)
        {
            column.Filter.DefaultMethod = current;

            String actual   = column.WithFilterOptions(new SelectListItem[0]).Filter.DefaultMethod;
            String expected = method;

            Assert.Equal(expected, actual);
        }
 public static IGridColumn<T, TValue> WithFilterOptions<T, TValue>(this IGridColumn<T, TValue> column)
 {
     return column.WithFilterOptions(column
         .Grid
         .Source
         .OrderBy(column.Expression)
         .Select(column.Expression)
         .Select(value => value == null ? null : value.ToString())
         .Distinct()
         .Select(value => new SelectListItem
         {
             Value = value,
             Text = value
         }));
 }