Exemplo n.º 1
0
        public override void Arrange()
        {
            var actionGenerator =
                new DomainGenerator()
                .With <Action <IList <Exception> > >(
                    // repetition increases likelyhood
                    l => l.Add(null),
                    l => l.Add(null),
                    l => l.Add(null),
                    l => l.Add(null),
                    l =>
            {
                Exception exception = new BusinessException();
                l.Add(exception);
                throw exception;
            },
                    l =>
            {
                Exception exception = new SecurityException();
                l.Add(exception);
                throw exception;
            },
                    l =>
            {
                Exception exception = new UnknownException();
                l.Add(exception);
                throw exception;
            },
                    l =>
            {
                Exception exception = new AnotherUnknownException();
                l.Add(exception);
                throw exception;
            });

            input =
                new DomainGenerator()
                .With <ProcessOneWayRequestsInput>(
                    opt => opt.For(i => i.OneWayRequestsAndHandlers, new OneWayRequestsAndHandlers()))
                .With <ProcessOneWayRequestsInput>(
                    opt => opt.For(i => i.Actions, actionGenerator.Many <Action <IList <Exception> > >(3, 3).ToList()))
                .One <ProcessOneWayRequestsInput>();
        }
        public override void Arrange()
        {
            var actionGenerator =
                new DomainGenerator()
                    .With<Action<IList<Exception>>>(
                        // repetition increases likelyhood
                    l => l.Add(null),
                    l => l.Add(null),
                    l => l.Add(null),
                    l => l.Add(null),
                    l =>
                        {
                            Exception exception = new BusinessException();
                            l.Add(exception);
                            throw exception;
                        },
                    l =>
                        {
                            Exception exception = new SecurityException();
                            l.Add(exception);
                            throw exception;
                        },
                    l =>
                        {
                            Exception exception = new UnknownException();
                            l.Add(exception);
                            throw exception;
                        },
                    l =>
                        {
                            Exception exception = new AnotherUnknownException();
                            l.Add(exception);
                            throw exception;
                        });

            input =
                new DomainGenerator()
                    .With<ProcessOneWayRequestsInput>(
                        opt => opt.For(i => i.OneWayRequestsAndHandlers, new OneWayRequestsAndHandlers()))
                    .With<ProcessOneWayRequestsInput>(
                        opt => opt.For(i => i.Actions, actionGenerator.Many<Action<IList<Exception>>>(3, 3).ToList()))
                    .One<ProcessOneWayRequestsInput>();
        }