public void ProcessOnePageTest()
        {
            var mg          = MockHtmlGenerator();
            var viewContext = GetViewContext();
            var Routes      = new Dictionary <string, string>();



            mg.Setup(x => x.GenerateActionLink(viewContext, It.IsAny <string>(), null, null, null, null, null, It.IsAny <Dictionary <string, string> >(), It.IsAny <Object>()))
            .Returns((ViewContext v, string text, string a, string c, string p, string h, string pr, Dictionary <string, string> routes, object attr) => {
                var tag = new TagBuilder("div");
                tag.InnerHtml.Append(text);
                return(tag);
            });

            var options = new CoreGridFSPOptions();

            options.PaginationOptions.Count = 5;

            var p = new PaginationTagHelper(mg.Object);

            p.Options = options;

            p.ViewContext = viewContext;

            var output = GetTagHelperOutput();

            p.Process(GetTagHelperContext(), output);

            Assert.IsNotNull(output);
            var expected = "<ul class=\"pagination flex-wrap\"><li class=\"disabled page-item\"><div aria-label=\"First\" class=\"page-link\"><span aria-hidden=\"true\">|&lt;</span><span class=\"sr-only\">First</span></div></li><li class=\"disabled page-item\"><div aria-label=\"Next\" class=\"page-link\"><span aria-hidden=\"true\">&lt;</span><span class=\"sr-only\">Next</span></div></li><li class=\"active page-item\"><div class=\"page-link\">1</div></li><li class=\"disabled page-item\"><div aria-label=\"Previous\" class=\"page-link\"><span aria-hidden=\"true\">&gt;</span><span class=\"sr-only\">Previous</span></div></li><li class=\"disabled page-item\"><div aria-label=\"Last\" class=\"page-link\"><span aria-hidden=\"true\">&gt;|</span><span class=\"sr-only\">Last</span></div></li><li class=\"page-item\"><button class=\"btn-outline-secondary btn\" type=\"button\">Page Size 10</button><button aria-expanded=\"false\" aria-haspopup=\"true\" class=\"dropdown-toggle-split dropdown-toggle btn-outline-secondary btn\" data-toggle=\"dropdown\" type=\"button\"><span class=\"sr-only\">Toggle Dropdown</span></button><div class=\"dropdown-menu\"><div aria-label=\"All\" class=\"page-link dropdown-item\">All</div><div aria-label=\"5\" class=\"page-link dropdown-item\">5</div><div aria-label=\"10\" class=\"page-link dropdown-item\">10</div><div aria-label=\"20\" class=\"page-link dropdown-item\">20</div><div aria-label=\"50\" class=\"page-link dropdown-item\">50</div><div aria-label=\"100\" class=\"page-link dropdown-item\">100</div></div></li></ul>";

            Assert.AreEqual(expected, output.Content.GetContent());
        }
        /// <summary>
        /// Extracts core grid options from a request query string
        /// </summary>
        /// <param name="request">The HttpRequest</param>
        /// <returns>A populated CoreGridFSPOptions object</returns>
        public static CoreGridFSPOptions ExtractCoreGridOptions(this HttpRequest request)
        {
            var gridOptions       = new CoreGridFSPOptions();
            var paginationOptions = new PaginationOptions()
            {
                Count = 1
            };

            foreach (var param in request.Query)
            {
                var lkey = param.Key.Trim().ToLower();
                if (lkey == "selectedsort")
                {
                    gridOptions.SelectedSort = param.Value;
                }
                else if (lkey == "currentpage")
                {
                    int page = 1;
                    int.TryParse(param.Value, out page);
                    paginationOptions.CurrentPage = page;
                }
                else if (lkey == "pagesize")
                {
                    int pageSize = 0;
                    if (int.TryParse(param.Value, out pageSize))
                    {
                        paginationOptions.PageSize = pageSize;
                    }
                }
                else
                {
                    if (gridOptions.FilterList.ContainsKey(param.Key))
                    {
                        gridOptions.FilterList.Add(param.Key, param.Value);
                    }
                    else
                    {
                        gridOptions.FilterList[param.Key] = param.Value;
                    }
                }
            }

            gridOptions.PaginationOptions = paginationOptions;
            return(gridOptions);
        }
        public void ProcessCustomButtonTest()
        {
            var mg          = MockHtmlGenerator();
            var viewContext = GetViewContext();
            var Routes      = new Dictionary <string, string>();

            Routes.Add("pageSize", "10");
            Routes.Add("id", "1");


            var editTag = new TagBuilder("div");

            editTag.InnerHtml.Append("Edit");
            mg.Setup(x => x.GenerateActionLink(viewContext, "Edit", "Edit", null, null, null, null, Routes, It.IsAny <Object>())).Returns(editTag);
            var deleteTag = new TagBuilder("div");

            deleteTag.InnerHtml.Append("Delete");
            mg.Setup(x => x.GenerateActionLink(viewContext, "Delete", "Delete", null, null, null, null, Routes, It.IsAny <Object>())).Returns(deleteTag);
            var detailsTag = new TagBuilder("div");

            detailsTag.InnerHtml.Append("Details");
            mg.Setup(x => x.GenerateActionLink(viewContext, "Details", "Details", null, null, null, null, Routes, It.IsAny <Object>())).Returns(detailsTag);

            var options = new CoreGridFSPOptions();


            var r = new RowActionTagHelper(mg.Object);

            r.LableName   = "TestLabel";
            r.ButtonClass = "btn TestClass btn";//expect it to remove the extra btn
            r.RouteValues = Routes;
            r.Options     = options;
            r.ViewContext = viewContext;

            var output = GetTagHelperOutput();

            r.Process(GetTagHelperContext(), output);

            Assert.IsNotNull(output);
            var expected = "<button class=\"TestClass btn\">TestLabel</button><button aria-expanded=\"false\" aria-haspopup=\"true\" class=\"dropdown-toggle-split dropdown-toggle btn-outline-secondary btn\" data-toggle=\"dropdown\" type=\"button\"><span class=\"sr-only\">Toggle Dropdown</span></button><div class=\"dropdown-menu\"><div>Edit</div><div>Delete</div><div>Details</div></div>";

            Assert.AreEqual(expected, output.Content.GetContent());
        }