public void SumAllGroups () { var container = new ExportContainer(); container.ExportedItems.AddRange(collection); var visitor = new ExpressionVisitor (reportSettings); visitor.SetCurrentDataSource(dataSource.GroupedList); foreach (var group in dataSource.GroupedList) { var script = "= sum('randomint')"; collection[0].Text = script; visitor.SetCurrentDataSource(group); visitor.Visit(container); var result = list.Where(k => k.GroupItem == group.Key.ToString()).Sum(x => x.RandomInt); Assert.That(Convert.ToDouble(collection[0].Text),Is.EqualTo(result)); } }
public void SumGroupedList() { var visitor = new ExpressionVisitor (reportSettings); visitor.SetCurrentDataSource(dataSource.GroupedList); var script = "= sum('randomint')"; collection[0].Text = script; visitor.Visit(collection[0]); var result = list.Sum(x => x.RandomInt); Assert.That(Convert.ToDouble(collection[0].Text),Is.EqualTo(result)); }
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); }