Beispiel #1
0
        public void Should_not_collide_with_two_controllers()
        {
            var view = new XtraReport {
                DataSource = new[] { new object(), new object() }
            };

            var counterA = 0;
            var counterB = 0;

            var actionA = ReportRuntimeAction <XRControl> .WithNoPredicate(c => counterA++);

            var actionB = ReportRuntimeAction <XRControl> .WithNoPredicate(c => counterB++);

            var facadeA = new XRRuntimeActionFacade(actionA);
            var facadeB = new XRRuntimeActionFacade(actionB);

            var controllerA = new XRReportController(view, facadeA);
            var controllerB = new XRReportController(view, facadeB);

            controllerA.Print(r => r.ExportToMemory());
            controllerB.Print(r => r.ExportToMemory());

            counterA.Should().Be(1);
            counterB.Should().Be(1);
        }
 public void GivenAnActionExistsToPlaceTheImageIntoThePlaceholder()
 {
     _action = ReportRuntimeAction <XRPictureBox> .WithNoPredicate(p => p.ImageUrl = _imageFileName);
 }
        public void Should_handle_detail_reports()
        {
            var textvalues = new List <Tuple <int, string> >();
            var report     = new XtraReportWithLabelInDetailReport();

            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());

            counter.Should().Be(6);
        }
        protected void RegisterFor <T>(Action <T> toDo) where T : XRControl
        {
            var action = ReportRuntimeAction <T> .WithNoPredicate(toDo);

            _toDos.Add(action);
        }