public void CanConcatParameter()
        {
            var parameters = new ParameterCollection();
            parameters.Add(new BasicParameter() {
                           	ParameterName = "param1",
                           	ParameterValue = "SharpDevelop"
                           }
                          );

            parameters.Add(new BasicParameter() {
                           	ParameterName = "param2",
                           	ParameterValue = " is "
                           }
                          );
            parameters.Add(new BasicParameter() {
                           	ParameterName = "param3",
                           	ParameterValue = "great"
                           }
                          );

            var reportSettings = CreateReportSettings(parameters);
            var visitor = new ExpressionVisitor(reportSettings);

            var script = "=Parameters!param1 + Parameters!param2 + Parameters!param3";
            collection[0].Text = script;
            visitor.Visit(collection[0]);
            Assert.That (collection[0].Text,Is.EqualTo("SharpDevelop is great"));
        }
		public ExpressionRunner(Collection<ExportPage> pages,ReportSettings reportSettings,CollectionDataSource dataSource)
		{
			this.pages = pages;
			this.dataSource = dataSource;
			this.reportSettings = reportSettings;
			Visitor = new ExpressionVisitor(reportSettings);
		}
Beispiel #3
0
 public void CreateExportlist()
 {
     collection = new Collection<ExportText>();
     collection.Add(new ExportText()
                    {
                    	Text = "myExporttextColumn"
                    });
     visitor = new ExpressionVisitor (new ReportSettings());
 }
 public void CreateSut()
 {
     collection = new Collection<ExportText>();
     collection.Add(new ExportText()
                    {
                    	Text = String.Empty
                    });
     expressionVisitor = new ExpressionVisitor(new ReportSettings());
 }
		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);
		}
		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 Setup()
 {
     expressionVisitor = new ExpressionVisitor(new ReportSettings());
 }
        public void ParameterNotExist()
        {
            var parameters = new ParameterCollection();
            parameters.Add(new BasicParameter() {
                           	ParameterName = "param1",
                           	ParameterValue = "SharpDevelop"
                           }
                          );
            var reportSettings = CreateReportSettings(parameters);
            var visitor = new ExpressionVisitor(reportSettings);

            var script = "=Parameters!paramNotExist";
            collection[0].Text = script;
            visitor.Visit(collection[0]);
            Assert.That (collection[0].Text.StartsWith("Missing"));
            Assert.That (collection[0].Text.Contains("paramNotExist"));
        }