Ejemplo n.º 1
0
		public void GroupbyOneColumnSortSubList () {
			var rs = new ReportSettings();
			var gc = new GroupColumn() {
				ColumnName ="GroupItem",
				SortDirection = ListSortDirection.Ascending,
				GroupSortColumn = new SortColumn() {
					ColumnName = "Randomint",
					SortDirection = ListSortDirection.Ascending
				}
			};
			rs.GroupColumnsCollection.Add(gc);
			var collectionSource = new CollectionDataSource	(list,rs);
			collectionSource.Bind();
			var testKey = String.Empty;
			var testSubKey = -1;
			var groupedList = collectionSource.GroupedList;
			foreach (var element in groupedList) {
				Assert.That(element.Key,Is.GreaterThan(testKey));
				testKey = element.Key.ToString();
				foreach (Contributor sub in element) {
					Assert.That(sub.RandomInt,Is.GreaterThanOrEqualTo(testSubKey));
					testSubKey = sub.RandomInt;
				}
				testSubKey = -1;
			}
		}
Ejemplo n.º 2
0
		public ExpressionRunner(Collection<ExportPage> pages,ReportSettings reportSettings,CollectionDataSource dataSource)
		{
			this.pages = pages;
			this.dataSource = dataSource;
			this.reportSettings = reportSettings;
			Visitor = new ExpressionVisitor(reportSettings);
		}
Ejemplo n.º 3
0
		public void GroupbyOneColumn () {
			var rs = new ReportSettings();
			rs.GroupColumnsCollection.Add( new GroupColumn("GroupItem",1,ListSortDirection.Ascending));
			var collectionSource = new CollectionDataSource	(list,rs);
			collectionSource.Bind();
			var testKey = String.Empty;
			var groupedList = collectionSource.GroupedList;
			foreach (var element in groupedList) {
				Assert.That(element.Key,Is.GreaterThan(testKey));
				testKey = element.Key.ToString();
			}
		}
Ejemplo n.º 4
0
		public void CreateExportlist() {
			collection = new Collection<ExportText>();
			collection.Add(new ExportText()
			               {
			               	Text = String.Empty
			               });
			
			helper = new AggregateFuctionHelper();
			aggregateCollection = helper.AggregateCollection;
			dataSource = new CollectionDataSource(aggregateCollection,new ReportSettings());
			dataSource.Bind();
			visitor = new ExpressionVisitor(new ReportSettings());
			visitor.SetCurrentDataSource(dataSource.SortedList);
		}
        public void CreateExportlist()
        {
            reportItemCollection = new Collection<ExportText>();
            reportItemCollection.Add(new ExportText()
                           {
                           	Text = String.Empty
                           });

            var contributorList = new ContributorsList();
            list = contributorList.ContributorCollection;
            reportSettings = new ReportSettings();
            reportSettings.GroupColumnsCollection.Add(

                new GroupColumn("groupItem",1,ListSortDirection.Ascending )
            );

            dataSource = new CollectionDataSource(list,reportSettings);
            dataSource.Bind();
        }
Ejemplo n.º 6
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.º 7
0
		void CreateDataSource(){
			DataSource = new CollectionDataSource(List, ReportModel.ReportSettings);
			if (DataSourceContainsData()) {
				DataSource.Bind();
			}
		}
Ejemplo n.º 8
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.º 9
0
 public void CollectionCountIsEqualToListCount()
 {
     var collectionSource = new CollectionDataSource	(list,new ReportSettings());
     Assert.That(collectionSource.Count,Is.EqualTo(list.Count));
 }
Ejemplo n.º 10
0
 public void AvailableFieldsEqualContibutorsPropertyCount()
 {
     var collectionSource = new CollectionDataSource	(list,new ReportSettings());
     Assert.That(collectionSource.AvailableFields.Count,Is.EqualTo(6));
 }
Ejemplo n.º 11
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.º 12
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.º 13
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.º 14
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));
        }