public DatalistExtensionsTests()
        {
            HttpContext.Current = new HttpContext(
                new HttpRequest(null, "http://localhost:7013/", null),
                new HttpResponse(new StringWriter()));

            datalist  = new TestDatalistProxy();
            testModel = new TestModel();
            html      = MockHtmlHelper();
        }
        public void GenericDatalist_Url_CallsGetColumnCssClass()
        {
            datalistMock          = new Mock <TestDatalistProxy>(new UrlHelper(HttpContext.Current.Request.RequestContext));
            datalistMock.CallBase = true;
            datalist = datalistMock.Object;

            IEnumerable <PropertyInfo> properties = datalist.BaseAttributedProperties;
            Int32 callCount = datalist.BaseAttributedProperties.Count();

            datalistMock.Protected().Verify("GetColumnCssClass", Times.Exactly(callCount), ItExpr.Is <PropertyInfo>(match => properties.Contains(match)));
        }
        public GenericDatalistTests()
        {
            HttpContext.Current = new HttpContext(
                new HttpRequest(null, "http://localhost:7013/", null),
                new HttpResponse(new StringWriter()));

            datalistMock = new Mock <TestDatalistProxy> {
                CallBase = true
            };
            row      = new Dictionary <String, String>();
            datalist = datalistMock.Object;
        }
        public void GenericDatalist_Url_AddsColumns()
        {
            datalistMock          = new Mock <TestDatalistProxy>(new UrlHelper(HttpContext.Current.Request.RequestContext));
            datalistMock.CallBase = true;
            datalist = datalistMock.Object;

            DatalistColumns columns = new DatalistColumns();

            foreach (PropertyInfo property in datalist.BaseAttributedProperties)
            {
                columns.Add(new DatalistColumn(datalist.BaseGetColumnKey(property), datalist.BaseGetColumnHeader(property)));
            }

            IEnumerator <DatalistColumn> expected = columns.GetEnumerator();
            IEnumerator <DatalistColumn> actual   = datalist.Columns.GetEnumerator();

            while (expected.MoveNext() | actual.MoveNext())
            {
                Assert.Equal(expected.Current.Key, actual.Current.Key);
                Assert.Equal(expected.Current.Header, actual.Current.Header);
                Assert.Equal(expected.Current.CssClass, actual.Current.CssClass);
            }
        }