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

            Assert.Same(expected, actual);
        }
예제 #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);
        }
예제 #3
0
 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
         }));
 }