public void XtraReport_should_fire_event_properly() { var report = new XtraReportWithSubReportInDetailReport(); report.DataSource = new List <Person2> { new Person2 { Name = "Douglas Sam", Age = 17, Dogs = new List <Dog> { new Dog { Name = "Rex" }, new Dog { Name = "Rudy" } } }, new Person2 { Name = "Fred Thomas", Age = 35, Dogs = new List <Dog> { new Dog { Name = "Sally" }, new Dog { Name = "Stubert" } } }, new Person2 { Name = "Alex Matthew", Age = 100, Dogs = new List <Dog> { new Dog { Name = "Nibbles" }, new Dog { Name = "Norbert" } } } }; var detailReportBand = report.Controls.OfType <DetailReportBand>().Single(); var sr = (XRSubreport)detailReportBand.Bands[BandKind.Detail].Controls[0]; var label = (XRLabel)sr.ReportSource.Bands[BandKind.Detail].Controls[0]; var counter = 0; label.BeforePrint += (s, o) => counter++; report.ExportToMemory(); counter.Should().Be(6); }
public void XtraReport_should_fire_event_properly() { var report = new XtraReportWithSubReportInDetailReport(); report.DataSource = new List<Person2> { new Person2 { Name = "Douglas Sam", Age = 17, Dogs = new List<Dog> {new Dog {Name = "Rex"}, new Dog {Name = "Rudy"}} }, new Person2 { Name = "Fred Thomas", Age = 35, Dogs = new List<Dog> {new Dog {Name = "Sally"}, new Dog {Name = "Stubert"}} }, new Person2 { Name = "Alex Matthew", Age = 100, Dogs = new List<Dog> {new Dog {Name = "Nibbles"}, new Dog {Name = "Norbert"}} } }; var detailReportBand = report.Controls.OfType<DetailReportBand>().Single(); var sr = (XRSubreport) detailReportBand.Bands[BandKind.Detail].Controls[0]; var label = (XRLabel)sr.ReportSource.Bands[BandKind.Detail].Controls[0]; var counter = 0; label.BeforePrint += (s, o) => counter++; report.ExportToMemory(); counter.Should().Be(6); }
public void Should_handle_detail_reports_with_subreport() { var textvalues = new List <Tuple <int, string> >(); var report = new XtraReportWithSubReportInDetailReport(); report.DataSource = new List <Person2> { new Person2 { Name = "Douglas Sam", Age = 17, Dogs = new List <Dog> { new Dog { Name = "Rex" }, new Dog { Name = "Rudy" } } }, new Person2 { Name = "Fred Thomas", Age = 35, Dogs = new List <Dog> { new Dog { Name = "Sally" }, new Dog { Name = "Stubert" } } }, new Person2 { Name = "Alex Matthew", Age = 100, Dogs = new List <Dog> { new Dog { Name = "Nibbles" }, new Dog { Name = "Norbert" } } } }; int counter = 0; var action = ReportRuntimeAction <XRLabel> .WithNoPredicate(l => { counter++; textvalues.Add(new Tuple <int, string>(l.Report.GetHashCode(), l.Text)); }); var facade = new XRRuntimeActionFacade(action); var c = new XRReportController(report, facade); var newReport = c.Print(a => a.ExportToMemory()); //Not safe for batch test runs GlobalXRSubscriber.Singleton.Visitors.Count.Should().Be(2); counter.Should().Be(6); }
public void Should_handle_detail_reports_with_subreport() { var textvalues = new List<Tuple<int,string>>(); var report = new XtraReportWithSubReportInDetailReport(); report.DataSource = new List<Person2> { new Person2 { Name = "Douglas Sam", Age = 17, Dogs = new List<Dog> {new Dog {Name = "Rex"}, new Dog {Name = "Rudy"}} }, new Person2 { Name = "Fred Thomas", Age = 35, Dogs = new List<Dog> {new Dog {Name = "Sally"}, new Dog {Name = "Stubert"}} }, new Person2 { Name = "Alex Matthew", Age = 100, Dogs = new List<Dog> {new Dog {Name = "Nibbles"}, new Dog {Name = "Norbert"}} } }; int counter = 0; var action = ReportRuntimeAction<XRLabel>.WithNoPredicate(l => { counter++; textvalues.Add(new Tuple<int, string>(l.Report.GetHashCode(), l.Text)); }); var facade = new XRRuntimeActionFacade(action); var c = new XRReportController(report, facade); var newReport = c.Print(a=> a.ExportToMemory()); //Not safe for batch test runs GlobalXRSubscriber.Singleton.Visitors.Count.Should().Be(2); counter.Should().Be(6); }