public void Can_Use_Nested_Builder() { var builder = new BuilderForTesting <ExampleClass>(); builder.SetProperty <ExampleReferencedClassBuilder>(x => x.ReferenceProp); ExampleReferencedClass res = builder.GetProperty(x => x.ReferenceProp, () => null); res.Should().NotBeNull("Nested builder should create an instance."); }
public void Can_Use_Nested_Builder_With_SetProperty() { var builder = new BuilderForTesting <ExampleClass>(); builder.SetProperty <ExampleReferencedClassBuilder>(x => x.ReferenceProp, opts: o => o.WithStringProp("abc")); ExampleReferencedClass res = builder.GetProperty(x => x.ReferenceProp, () => null); res.Should().NotBeNull("Nested builder should create an instance."); res.StringProp.Should().Be("abc", "Nested builder should create an instance with applied opt-ins for the builder."); }