Ejemplo n.º 1
0
        public void DataItemWithNoColumnNameHasErrorMessageInDbValue()
        {
            var baseRow = new BaseRowItem();
            var dataItem = new BaseDataItem() {

            };

            baseRow.Items.Add(dataItem);

            var row = new System.Collections.Generic.List<IPrintableObject>();
            row.Add(baseRow);
            var reportSettings = new ReportSettings();
            var collectionSource = new CollectionDataSource (list,reportSettings);
            collectionSource.Bind();
            foreach (var element in collectionSource.SortedList) {
                collectionSource.Fill(row,element);
                var r = (BaseRowItem)row[0];
                foreach (var result in r.Items) {
                    Assert.That(((BaseDataItem)result).DBValue.StartsWith("Missing"),Is.EqualTo(true));
                }
            }
        }
Ejemplo n.º 2
0
        public void FillDataIncludedInRow()
        {
            var baseRow = new BaseRowItem();
            var dataItemsCollection = CreateDataItems();
            baseRow.Items.AddRange(dataItemsCollection);

            var row = new System.Collections.Generic.List<IPrintableObject>();
            row.Add(baseRow);
            var reportSettings = new ReportSettings();
            var collectionSource = new CollectionDataSource (list,reportSettings);
            collectionSource.Bind();
            int i = 0;
            foreach (var element in collectionSource.SortedList) {
                collectionSource.Fill(row,element);
                var r = (BaseRowItem)row[0];
                foreach (var result in r.Items) {
                    Assert.That(((BaseDataItem)result).DBValue,Is.Not.Empty);
                }
                i ++;
            }
            Assert.That(i,Is.EqualTo(collectionSource.Count));
        }
Ejemplo n.º 3
0
        public void TypeOfReportItemIsString()
        {
            var ric = new System.Collections.Generic.List<IPrintableObject>(){
                new BaseDataItem(){
                    ColumnName = "Lastname"

                },
                new BaseDataItem(){
                    ColumnName = "Firstname"
                }
            };
            var collectionSource = new CollectionDataSource	(list,new ReportSettings());
            collectionSource.Bind();
            var result = collectionSource.SortedList.FirstOrDefault();
            collectionSource.Fill(ric,result);
            foreach (BaseDataItem element in ric) {
                Assert.That(element.DataType,Is.EqualTo("System.String"));
            }
        }
Ejemplo n.º 4
0
        public void SortOneColumnAscending()
        {
            var ric = new System.Collections.Generic.List<IPrintableObject>(){
                new BaseDataItem(){
                    ColumnName = "Lastname"
                },
                new BaseDataItem(){
                    ColumnName = "Firstname"
                }
            };

            var rs = new ReportSettings();
            rs.SortColumnsCollection.Add(new SortColumn("Lastname",ListSortDirection.Ascending));
            var collectionSource = new CollectionDataSource	(list,rs);
            collectionSource.Bind();
            string compare = String.Empty;
            int i = 0;
            foreach (var element in collectionSource.SortedList) {
                collectionSource.Fill(ric,element);
            //				Console.WriteLine("first : <{0}> Last <{1}> ",((BaseDataItem)ric[0]).DBValue,((BaseDataItem)ric[1]).DBValue);

                Assert.That(((BaseDataItem)ric[0]).DBValue,Is.GreaterThanOrEqualTo(compare));

                compare = ((BaseDataItem)ric[0]).DBValue;
                i++;
            }
            /*
            do {
                collectionSource.Fill(ric);
                Console.WriteLine("first : <{0}> Last <{1}> ",((BaseDataItem)ric[0]).DBValue,
                                  ((BaseDataItem)ric[1]).DBValue);
                Assert.That(((BaseDataItem)ric[0]).DBValue,Is.GreaterThanOrEqualTo(compare));
                compare = ((BaseDataItem)ric[0]).DBValue;

                i ++;
            }while (collectionSource.MoveNext());

             */
            Assert.That(i,Is.EqualTo(collectionSource.Count));
        }
Ejemplo n.º 5
0
        public void RowContainsRowAndItem()
        {
            var row = new System.Collections.Generic.List<IPrintableObject>();
                var gItem = 	new BaseDataItem(){
                    ColumnName = "GroupItem"
                };
            row.Add(gItem);

            var baseRow = new BaseRowItem();

            var ric = new System.Collections.Generic.List<IPrintableObject>(){
                new BaseDataItem(){
                    ColumnName = "Lastname"

                },
                new BaseDataItem(){
                    ColumnName = "Firstname"
                }
            };
            baseRow.Items.AddRange(ric);
            row.Add(baseRow);
            var rs = new ReportSettings();
            var collectionSource = new CollectionDataSource (list,rs);
            collectionSource.Bind();
            int i = 0;
            foreach (var element in collectionSource.SortedList) {
                collectionSource.Fill(row,element);
                var res = (BaseDataItem)row.Find(c => ((BaseDataItem)c).ColumnName == "GroupItem");
                Assert.That(res.DBValue,Is.Not.Empty);
                i ++;
            }
            Assert.That(i,Is.EqualTo(collectionSource.Count));
        }
Ejemplo n.º 6
0
        public void GroupbyOneColumnAndFill()
        {
            var dataItemsCollection = CreateDataItems();
            var reportsettings = new ReportSettings();
            reportsettings.GroupColumnsCollection.Add( new GroupColumn("GroupItem",1,ListSortDirection.Ascending));

            var collectionSource = new CollectionDataSource (list,reportsettings);
            collectionSource.Bind();
            int i = 0;

            foreach (var element in collectionSource.GroupedList) {
                Console.WriteLine("Key {0} ",element.Key);
                foreach (var l in element) {
                    collectionSource.Fill(dataItemsCollection,l);
            //					Console.WriteLine("first : <{0}> Last <{1}> Group <{2}> Randomint <{3}>",((BaseDataItem)dataItemsCollection[0]).DBValue,
            //					                  ((BaseDataItem)dataItemsCollection[1]).DBValue,
            //					                  ((BaseDataItem)dataItemsCollection[2]).DBValue,
            //					                  ((BaseDataItem)dataItemsCollection[3]).DBValue);
                    i++;
                }
            }
            /*
            do {
                collectionSource.Fill(dataItemsCollection);
                Console.WriteLine("first : <{0}> Last <{1}> Group <{2}> Randomint <{3}>",((BaseDataItem)dataItemsCollection[0]).DBValue,
                                  ((BaseDataItem)dataItemsCollection[1]).DBValue,
                                  ((BaseDataItem)dataItemsCollection[2]).DBValue,
                                  ((BaseDataItem)dataItemsCollection[3]).DBValue);
                i ++;
            }while (collectionSource.MoveNext());
            */
            Assert.That(i,Is.EqualTo(collectionSource.Count));
        }