public void CorrectNumberOfRows()
        {
            // Arrange
            var items = CreateItems(5);
            var data = items.AsQueryable().ToPagedList(1, 2);

            // Act
            var fakeHtmlHelper = new FakeHtmlHelper();
            var results = DataGridHelper.DataGrid<Product>(fakeHtmlHelper, data);

            // Assert (1 header row + 2 data rows + 1 pager row)
            Assert.AreEqual(4, Regex.Matches(results, "<tr>").Count);
        }
        public void SecondPageNumberSelected()
        {
            // Arrange
            var items = CreateItems(5);
            var data = items.AsQueryable().ToPagedList(1, 2);

            // Act
            var fakeHtmlHelper = new FakeHtmlHelper();
            var results = DataGridHelper.DataGrid<Product>(fakeHtmlHelper, data);

            // Assert
            StringAssert.Contains(results, "<strong>2</strong>");
        }
        public void ContainsHtmlRow()
        {
            // Arrange products
            var products = new List<Product>();
            products.Add(Product.CreateProduct(-1, "Laptop", "A laptop", 878.23m));
            products.Add(Product.CreateProduct(-1, "Telescope", "A telescape", 200.19m));

            // Arrange HTML helper
            var helper = new FakeHtmlHelper();
            helper.ViewData.Model = products;

            // Act
            var result = ProductHelper.ProductList(helper);

            // Assert
            StringAssert.Contains(result, "<td>Laptop</td><td>$878.23</td>");
        }