public void AddMany_Will_Reuse_Same_Item_Builder() { var parentBuilder = new BuilderForTesting <ExampleClass>(); var t = new CollectionBuilder <ExampleChildClass, ExampleChildClassBuilder>(parentBuilder); t.AddMany(3); t.Builders.Count.Should().Be(3); t.Builders.Should().OnlyContain(x => x == t.Builders[0]); }
public void AddMany_With_Instances_Will_Add_Item_Builders_With_These_Instances_To_Builders() { var parentBuilder = new BuilderForTesting <ExampleClass>(); var t = new CollectionBuilder <ExampleChildClass, ExampleChildClassBuilder>(parentBuilder); var c = new[] { new ExampleChildClass(), new ExampleChildClass(), new ExampleChildClass() }; t.AddMany(c); t.Builders.Count.Should().Be(3); t.CreateAll().Should().Contain(c); }
public void AddMany_With_Builder_Options_Will_Apply_These_Options_To_Each_Builder() { var parentBuilder = new ExampleClassBuilder(); var test = parentBuilder .WithChildren(c => c .AddOne()) .Create(); var t = new CollectionBuilder <ExampleChildClass, ExampleChildClassBuilder>(parentBuilder); t.AddMany(3, opts => opts.WithSomething("ploeh")); t.Builders.Should().OnlyContain(x => x.Something == "ploeh"); }