public void create_column_json_with_data_elements() { var grid = new TargetGrid(); grid.Column(x => x.Count); grid.Data(x => x.IsCool); grid.Column(x => x.Name); var json = grid.As <IGridDefinition>().ToColumnJson(); json .ShouldEqual("[{name: \"Count\", field: \"Count\", id: \"Count\", sortable: true, frozen: false}, {name: \"Name\", field: \"Name\", id: \"Name\", sortable: true, frozen: false}]"); }
public void create_column_json_with_authorization_field_rights() { var grid = new TargetGrid(); grid.Column(x => x.Count); grid.Data(x => x.IsCool); grid.Column(x => x.Name); grid.Column(x => x.Random); var service = new StubFieldAccessService(); service.SetRights <GridDefTarget>(x => x.Random, AccessRight.None); service.SetRights <GridDefTarget>(x => x.Name, AccessRight.ReadOnly); var json = grid.As <IGridDefinition>().ToColumnJson(service); json .ShouldEqual("[{name: \"en-US_Count\", field: \"Count\", id: \"Count\", sortable: true, frozen: false}, {name: \"en-US_Name\", field: \"Name\", id: \"Name\", sortable: true, frozen: false}]"); }