Ejemplo 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]));
        }
Ejemplo 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]));
        }
Ejemplo n.º 3
0
        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]));
        }
Ejemplo n.º 4
0
        public void IsApplied()
        {
            var spy = new ForEachSpy();

            var domainGenerator =
                new DomainGenerator()
                    .OneToMany<SomethingElseToGenerate, SomethingToGenerate>(
                        1, (l, r) => { l.SomethingToGenerates.Add(r); r.MySomethingElseToGenerate = l; })
                    .ForEach<IThing>(spy.Check);

            var somethingElseToGenerate = domainGenerator.One<SomethingElseToGenerate>();
            Assert.True(spy.Checked.Contains(somethingElseToGenerate));
            Assert.True(spy.Checked.Contains(somethingElseToGenerate.SomethingToGenerates.First()));
        }
Ejemplo n.º 5
0
        public void IsApplied()
        {
            var spy = new ForEachSpy();

            var domainGenerator =
                new DomainGenerator()
                .OneToMany <SomethingElseToGenerate, SomethingToGenerate>(
                    1, (l, r) => { l.SomethingToGenerates.Add(r); r.MySomethingElseToGenerate = l; })
                .ForEach <BaseThing <int> >(spy.Check);

            var somethingElseToGenerate = domainGenerator.One <SomethingElseToGenerate>();

            Assert.True(spy.Checked.Contains(somethingElseToGenerate));
            Assert.True(spy.Checked.Contains(somethingElseToGenerate.SomethingToGenerates.First()));
        }
Ejemplo n.º 6
0
        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]));
        }