Exemple #1
0
        public void FormDatalistData_FormsColumns()
        {
            DatalistColumns expected = datalist.Columns;
            DatalistColumns actual   = datalist.BaseFormDatalistData(datalist.BaseGetModels()).Columns;

            Assert.AreEqual(expected, actual);
        }
 public void SetUp()
 {
     columns     = new DatalistColumns();
     testColumns = new List <DatalistColumn>
     {
         new DatalistColumn("Test1", String.Empty),
         new DatalistColumn("Test2", String.Empty),
     };
 }
        public DatalistColumnsTests()
        {
            allColumns = new List <DatalistColumn>
            {
                new DatalistColumn("Test1", "Header1", "Class1"),
                new DatalistColumn("Test2", "Header2", "Class2")
            };

            columns = new DatalistColumns();

            foreach (DatalistColumn column in allColumns)
            {
                columns.Add(column);
            }
        }
        public void Add_ColumnFromValues()
        {
            columns = new DatalistColumns();
            foreach (DatalistColumn column in allColumns)
            {
                columns.Add(column.Key, column.Header, column.CssClass);
            }

            IEnumerator <DatalistColumn> expected = allColumns.GetEnumerator();
            IEnumerator <DatalistColumn> actual   = 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);
            }
        }
Exemple #5
0
        public void GenericDatalist_AddsColumns()
        {
            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.AreEqual(expected.Current.Key, actual.Current.Key);
                Assert.AreEqual(expected.Current.Header, actual.Current.Header);
                Assert.AreEqual(expected.Current.CssClass, actual.Current.CssClass);
            }
        }
        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);
            }
        }
        public void DatalistColumns_AreEmpty()
        {
            columns = new DatalistColumns();

            Assert.Empty(columns);
        }