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>(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() .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())); }
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())); }
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])); }