Esempio n. 1
0
        public void IsApplied()
        {
            var spy = new ForEachSpy();

            var domainGenerator =
                new DomainGenerator()
                    .ForEach<Something>(spy.Check);

            var things = domainGenerator.Many<Something>(2).ToArray();
            Assert.True(spy.Checked.Contains(things[0]));
            Assert.True(spy.Checked.Contains(things[1]));
        }
Esempio n. 2
0
        public void IsApplied()
        {
            var spy = new ForEachSpy();

            var domainGenerator =
                new DomainGenerator()
                .ForEach <Something>(spy.Check);

            var things = domainGenerator.Many <Something>(2).ToArray();

            Assert.True(spy.Checked.Contains(things[0]));
            Assert.True(spy.Checked.Contains(things[1]));
        }
        public void IsApplied()
        {
            var spy = new ForEachSpy();

            var domainGenerator =
                new DomainGenerator()
                    .ForEach<Something>((i, e) => { if (i < 2) spy.Check(e); });

            var things = domainGenerator.Many<Something>(5).ToArray();
            Assert.Equal(2, spy.Checked.Count);
            Assert.True(spy.Checked.Contains(things[0]));
            Assert.True(spy.Checked.Contains(things[1]));
        }
        public void IsApplied()
        {
            var spy = new ForEachSpy();

            var domainGenerator =
                new DomainGenerator()
                .ForEach <Something>((i, e) => { if (i < 2)
                                                 {
                                                     spy.Check(e);
                                                 }
                                     });

            var things = domainGenerator.Many <Something>(5).ToArray();

            Assert.Equal(2, spy.Checked.Count);
            Assert.True(spy.Checked.Contains(things[0]));
            Assert.True(spy.Checked.Contains(things[1]));
        }
Esempio n. 5
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>();
        }