public void applies_to_entire_report() { var color = Color.Green; var action = new ReportRuntimeAction<XtraReport>(r => true, r => r.BackColor = color); var report = new ReportFactory().GetNewReport(); var newReport = new XRReportController(report, new XRRuntimeActionFacade(action)).Print(r => r.ExportToMemory()); Assert.AreEqual(color, newReport.BackColor); }
public void datasource_should_resolves_types_when_setting_selected_datasource() { var designContext = TestHelper.CreateDesignerContext(); var factory = new ReportFactory(); var datasource1 = TestHelper.NorthwindDataSource; var report1 = (MyReportBase)factory.GetDefaultReport(); // Set Selected Design-Time Datasource report1.ChangeDesignTimeDatasource(datasource1, designContext); Assert.AreEqual(datasource1.DataSourceType, typeof(List<Order>)); Assert.AreEqual(datasource1.RootDataSourceType, typeof(List<Order>)); }
public void datasources_list_is_serialized() { var factory = new ReportFactory(); var abc = new DesignTimeDataSourceDefinition("a", "b", "c"); var xyz = new DesignTimeDataSourceDefinition("x", "y", "z"); var report1 = (MyReportBase)factory.GetDefaultReport(); // Collection report1.DesignTimeDataSources.Add(abc); report1.DesignTimeDataSources.Add(xyz); var report2 = TestHelper.RunThroughSerializer(report1); Assert.IsTrue(report2.DesignTimeDataSources.Count == 2); }
public void predicate_prevents_applying_action() { const string transformText = "Jeremiah"; var action = new ReportRuntimeAction<XRLabel>((l) => l.Text != string.Empty, (l) => l.Text = transformText); var label1 = new XRLabel { Text = string.Empty }; var label2 = new XRLabel { Text = "ChangeMe" }; var report = new ReportFactory().GetNewReport(); report.Bands[0].Controls.Add(label1); report.Bands[0].Controls.Add(label2); new XRReportController(report, new XRRuntimeActionFacade(action)).Print(r => r.ExportToMemory()); Assert.AreNotEqual(transformText, label1.Text); Assert.AreEqual(transformText, label2.Text); }
public void combine_parent_datasourcepath_with_band_memberpath() { var factory = new ReportFactory(); var designContext = TestHelper.CreateDesignerContext(); // Parent Report var report = factory.GetNewReport(); report.Name = "parentreport"; var definition = TestHelper.NorthwindDataSource; definition.DataSourceRelationPath = "[0]"; report.ChangeDesignTimeDatasource(definition, designContext); // Subreport Container var detailReportBand = new DetailReportBand(); detailReportBand.DataMember = "OrderDetails"; report.Bands.Add(detailReportBand); var path = detailReportBand.GetFullDataMemberPath(); Assert.AreEqual("[0].OrderDetails", path); }
public void datasource_should_serialize_all_properties() { var datasource1 = new DesignTimeDataSourceDefinition("mydatasource", "mypath", "myrelation") { RootDataSourceType = typeof(Product), DataSourceType = typeof(Order) }; var factory = new ReportFactory(); var report1 = (MyReportBase)factory.GetDefaultReport(); report1.DesignTimeDataSources.Add(datasource1); var report2 = TestHelper.RunThroughSerializer(report1); var datasource2 = report2.DesignTimeDataSources.Single(); // Assert all properties were serialized Assert.AreEqual(datasource1.DataSourceName, datasource2.DataSourceName); Assert.AreEqual(datasource1.DataSourceRelationPath, datasource2.DataSourceRelationPath); Assert.AreEqual(datasource1.DataSourceType, datasource2.DataSourceType); Assert.AreEqual(datasource1.RootDataSourceType, datasource2.RootDataSourceType); }
private static XRDesignForm CreateDesignForm() { // Create Runtime Report Designer XRDesignForm form = new XRDesignForm(); form.Text = "Ryan & Jer's Report Designer"; // Report Factory Service (which uses custom MyReportBase class) var service = new ReportFactory(); form.DesignMdiController.AddService(typeof(ReportTypeService), service); return form; }
public void should_traverse_when_changing_datasource() { var factory = new ReportFactory(); var designContext = TestHelper.CreateDesignerContext(); var report = factory.GetNewReport(); var definition = TestHelper.NorthwindDataSource; definition.DataSourceRelationPath = "Order_Details"; report.ChangeDesignTimeDatasource(definition, designContext); var datasource = report.DataSource; Assert.IsTrue(datasource is IEnumerable<Order_Detail>); }
public void Should_fire_actions_on_table_members() { var transformColor = Color.Blue; var action = new ReportRuntimeAction<XRControl>(c => true, c => c.BackColor = transformColor); var table = new XRTable(); var row = new XRTableRow(); var cell = new XRTableCell(); row.Cells.Add(cell); table.Rows.Add(row); var report = new ReportFactory().GetNewReport(); report.Bands[0].Controls.Add(table); //var subscriber = XRRuntimeSubscriber.SubscribeWithActions(action); new XRReportController(report, new XRRuntimeActionFacade(action)).Print(r => r.ExportToMemory()); Assert.AreEqual(transformColor, cell.BackColor); }