コード例 #1
0
        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"));
        }
コード例 #2
0
		public ExpressionRunner(Collection<ExportPage> pages,ReportSettings reportSettings,CollectionDataSource dataSource)
		{
			this.pages = pages;
			this.dataSource = dataSource;
			this.reportSettings = reportSettings;
			Visitor = new ExpressionVisitor(reportSettings);
		}
コード例 #3
0
 public void CreateExportlist()
 {
     collection = new Collection<ExportText>();
     collection.Add(new ExportText()
                    {
                    	Text = "myExporttextColumn"
                    });
     visitor = new ExpressionVisitor (new ReportSettings());
 }
コード例 #4
0
 public void CreateSut()
 {
     collection = new Collection<ExportText>();
     collection.Add(new ExportText()
                    {
                    	Text = String.Empty
                    });
     expressionVisitor = new ExpressionVisitor(new ReportSettings());
 }
コード例 #5
0
		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));
		}
コード例 #6
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);
		}
コード例 #7
0
		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));
			}
		}
コード例 #8
0
 public void Setup()
 {
     expressionVisitor = new ExpressionVisitor(new ReportSettings());
 }
コード例 #9
0
        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"));
        }