public GridColumnTests() { filters = Substitute.For <IGridFilters>(); grid = new Grid <GridModel>(new GridModel[0]); column = new GridColumn <GridModel, Object>(grid, model => model.Name); grid.ViewContext = new ViewContext(); grid.ViewContext.HttpContext = Substitute.For <HttpContext>(); grid.ViewContext.HttpContext.RequestServices.GetService <IGridFilters>().Returns(filters); }
public GridColumnTests() { grid = Substitute.For <IGrid <GridModel> >(); grid.Query = new QueryCollection(); grid.Name = "Grid"; column = new GridColumn <GridModel, Object>(grid, model => model.Name); grid.ViewContext = new ViewContext(); filters = Substitute.For <IGridFilters>(); grid.ViewContext.HttpContext = Substitute.For <HttpContext>(); grid.ViewContext.HttpContext.RequestServices.GetService <IGridFilters>().Returns(filters); }
public void Options_Get_FromFilters() { filter.Column.Grid.ViewContext = new ViewContext(); IGridFilters filters = Substitute.For <IGridFilters>(); filters.GetFilterOptions(filter.Column).Returns(new SelectListItem[0]); filter.Column.Grid.ViewContext.HttpContext = Substitute.For <HttpContext>(); filter.Column.Grid.ViewContext.HttpContext.RequestServices.GetService <IGridFilters>().Returns(filters); Object expected = filters.GetFilterOptions(filter.Column); Object actual = filter.Options; Assert.Same(expected, actual); }
public void Options_Get_FromFilters() { filter.Column.Grid.ViewContext = new ViewContext(); IGridFilters filters = Substitute.For <IGridFilters>(); filters.OptionsFor(filter.Column).Returns(Array.Empty <SelectListItem>()); filter.Column.Grid.ViewContext.HttpContext = Substitute.For <HttpContext>(); filter.Column.Grid.ViewContext.HttpContext.RequestServices.GetService(typeof(IGridFilters)).Returns(filters); Object expected = filters.OptionsFor(filter.Column); Object actual = filter.Options; Assert.Same(expected, actual); }
static GridColumnTests() { oldFilters = MvcGrid.Filters; }
static MvcGrid() { Filters = new GridFilters(); }
static MvcGrid() { Filters = new GridFilters(); }
public void TestFixtureSetUp() { oldFilters = MvcGrid.Filters; }