Exemplo n.º 1
0
        /// <summary>
        /// This method is called by the front end when it wants to display a page of horse data.
        /// </summary>
        public static PaginatedTable FilterSortPaginateTable(
            List <string> headers,
            List <List <object> > tableData,
            List <FilterMetadata> filters,
            SortMetadata sortMetadata,
            PaginationMetadata paginationMetadata)
        {
            // TODO: filter horse table using filters

            // TODO: sort horse table using sortMetadata

            // TODO: paginate horse table using paginationMetadata

            throw new NotImplementedException();
        }
Exemplo n.º 2
0
        /// <summary>
        /// This method is called by the front end when it wants to display a page of horse data.
        /// </summary>
        public static PaginatedTable FilterSortPaginateTable(
            List <string> headers,
            List <List <object> > tableData,
            List <FilterMetadata> filters,
            SortMetadata sortMetadata,
            PaginationMetadata paginationMetadata)
        {
            // TODO: filter horse table using filters

            // TODO: sort horse table using sortMetadata

            // TODO: paginate horse table using paginationMetadata

            var tableDataAsStrings = tableData.Select(row => row.Select(x => x.ToString()).ToList()).ToList();

            return(new PaginatedTable(headers, tableDataAsStrings, tableData.Count));
        }
Exemplo n.º 3
0
        public void FilterSortPaginate_No_Filter_No_Sort_No_Paginate()
        {
            //  this is data from another service or database
            var headers   = SampleHorseData.GetSampleHeaders();
            var tableData = SampleHorseData.GetSampleTableData();

            // These objects describe the query we got from the front end
            var filters = new List <FilterMetadata>()
            {
            };
            var sortMetadata       = new SortMetadata("", "");
            var paginationMetadata = new PaginationMetadata(0, 10);

            // Act
            var table = Horse.FilterSortPaginateTable(headers, tableData, filters, sortMetadata, paginationMetadata);

            // Assert the data to be sent to the front end
            Approvals.VerifyJson(Newtonsoft.Json.JsonConvert.SerializeObject(table));
        }