diff --git a/src-examples/BuilderConsumer/ClassWithInitProperties.cs b/src-examples/BuilderConsumer/ClassWithInitProperties.cs new file mode 100644 index 0000000..da73846 --- /dev/null +++ b/src-examples/BuilderConsumer/ClassWithInitProperties.cs @@ -0,0 +1,27 @@ +using FluentBuilder; + +namespace BuilderConsumer +{ + [AutoGenerateBuilder] + public class ClassWithInitProperties + { + public string Normal { get; set; } + + public int SiteId { get; init; } + + public string ProductName { get; init; } + + public string PrivateProductName { get; private init; } + + public required string RequiredTest { get; set; } + + public required string RequiredTestInit { get; init; } + + public required ClassWithInitProperties2 X { get; init; } + } + + public class ClassWithInitProperties2 + { + public required string X { get; set; } + } +} \ No newline at end of file diff --git a/src/FluentBuilderGenerator/Extensions/PropertySymbolExtensions.cs b/src/FluentBuilderGenerator/Extensions/PropertySymbolExtensions.cs index 77f11ed..5dd2a29 100644 --- a/src/FluentBuilderGenerator/Extensions/PropertySymbolExtensions.cs +++ b/src/FluentBuilderGenerator/Extensions/PropertySymbolExtensions.cs @@ -1,4 +1,5 @@ using FluentBuilderGenerator.Interfaces; +using FluentBuilderGenerator.Helpers; using FluentBuilderGenerator.Types; using Microsoft.CodeAnalysis; @@ -16,6 +17,30 @@ internal static class PropertySymbolExtensions FluentTypeKind.IReadOnlyList ]; + internal static IReadOnlyList GetRequiredPropertiesAsAssignments(this IEnumerable properties) + { + var requiredValues = new List(); + foreach (var p in properties.Where(p => p.IsRequired)) + { + var (defaultValue, _) = DefaultValueHelper.GetDefaultValue(p, p.Type); + requiredValues.Add($"{p.Name} = {defaultValue}"); + } + + return requiredValues; + } + + internal static IReadOnlyList GetRequiredPropertiesAsAssignments(this IEnumerable properties) + { + var requiredValues = new List(); + foreach (var p in properties.Where(p => p.Required)) + { + var (defaultValue, _) = DefaultValueHelper.GetDefaultValue(p.Symbol, p.Type); + requiredValues.Add($"{p.Name} = {defaultValue}"); + } + + return requiredValues; + } + internal static bool IsInitOnly(this IPropertySymbol property) { return property.SetMethod is { IsInitOnly: true }; diff --git a/src/FluentBuilderGenerator/FileGenerators/FluentBuilderClassesGenerator.cs b/src/FluentBuilderGenerator/FileGenerators/FluentBuilderClassesGenerator.cs index 57258d1..943233e 100644 --- a/src/FluentBuilderGenerator/FileGenerators/FluentBuilderClassesGenerator.cs +++ b/src/FluentBuilderGenerator/FileGenerators/FluentBuilderClassesGenerator.cs @@ -85,7 +85,7 @@ private string CreateClassBuilderCode(FluentData fluentData, ClassSymbol classSy throw new NotSupportedException($"Unable to generate a FluentBuilder for the class '{classSymbol.NamedTypeSymbol}' because no public constructor is defined."); } - var constructorCode = GenerateUsingConstructorCode(classSymbol, publicConstructors); + var constructorCode = GenerateUsingConstructorCode(fluentData, classSymbol, publicConstructors); var propertiesCode = GenerateWithPropertyCode(fluentData, classSymbol, allClassSymbols); @@ -129,14 +129,16 @@ public static partial class {classSymbol.BuilderClassName.ToSafeClassName()}Exte } private static (StringBuilder StringBuilder, IReadOnlyList ExtraUsings) GenerateUsingConstructorCode( + FluentData fluentData, ClassSymbol classSymbol, IReadOnlyList publicConstructors ) { - var builderClassName = classSymbol.BuilderClassName; - var extraUsings = new List(); + var builderClassName = classSymbol.BuilderClassName; + var (_, propertiesPublicSettable, _) = GetProperties(classSymbol, fluentData.HandleBaseClasses, fluentData.Accessibility); + var sb = new StringBuilder(); foreach (var publicConstructor in publicConstructors) { @@ -159,7 +161,13 @@ IReadOnlyList publicConstructors defaultValues.Add(defaultValue); } - sb.AppendLine(8, $"private Lazy<{classSymbol.NamedTypeSymbol}> _Constructor{constructorHashCode} = new Lazy<{classSymbol.NamedTypeSymbol}>(() => new {classSymbol.NamedTypeSymbol}({string.Join(", ", defaultValues)}));"); + var requiredProperties = propertiesPublicSettable.GetRequiredPropertiesAsAssignments(); + + sb.AppendLine(8, $"private Lazy<{classSymbol.NamedTypeSymbol}> _Constructor{constructorHashCode} = new Lazy<{classSymbol.NamedTypeSymbol}>(() => new {classSymbol.NamedTypeSymbol}({string.Join(",", defaultValues)})"); + sb.AppendLine(8, "{"); + sb.AppendLines(12, requiredProperties, ","); + sb.AppendLine(8, "});"); + sb.AppendLine(8, $"public {builderClassName} UsingConstructor({constructorParametersAsString})"); sb.AppendLine(8, @"{"); @@ -170,7 +178,10 @@ IReadOnlyList publicConstructors sb.AppendLine(8, $" return new {classSymbol.NamedTypeSymbol}"); sb.AppendLine(8, @" ("); sb.AppendLines(20, constructorParameters.Select(x => x.Symbol.Name), ", "); - sb.AppendLine(8, @" );"); + sb.AppendLine(8, @" )"); + sb.AppendLine(8, @" {"); + sb.AppendLines(20, requiredProperties, ","); + sb.AppendLine(8, @" };"); sb.AppendLine(8, @" });"); @@ -397,7 +408,7 @@ private static (bool IsPrimaryConstructor, IReadOnlyList new PropertyOrParameterSymbol(p, p.Type, true))); + propertiesPublicSettable.AddRange(publicConstructors[0].Parameters.Select(p => new PropertyOrParameterSymbol(p, p.Type, true, false))); } var properties = classSymbol.NamedTypeSymbol.GetMembers().OfType() @@ -423,7 +434,7 @@ private static (bool IsPrimaryConstructor, IReadOnlyList p.IsPublicSettable()).Select(p => new PropertyOrParameterSymbol(p, p.Type, p.IsInitOnly()))) + foreach (var property in properties.Where(p => p.IsPublicSettable()).Select(p => new PropertyOrParameterSymbol(p, p.Type, p.IsInitOnly(), p.IsRequired))) { if (propertiesPublicSettable.All(p => p.Name != property.Name)) { @@ -432,7 +443,7 @@ private static (bool IsPrimaryConstructor, IReadOnlyList p.IsPrivateSettable()).Select(p => new PropertyOrParameterSymbol(p, p.Type, p.IsInitOnly())).ToArray(); + properties.Where(p => p.IsPrivateSettable()).Select(p => new PropertyOrParameterSymbol(p, p.Type, p.IsInitOnly(), p.IsRequired)).ToArray(); return (isPrimaryConstructor, propertiesPublicSettable, propertiesPrivateSettable); } @@ -541,7 +552,11 @@ private static string GenerateSeveralMethods(FluentData fluentData, ClassSymbol var (defaultValue, _) = DefaultValueHelper.GetDefaultValue(p.Symbol, p.Symbol.Type); defaultValues.Add(defaultValue); } - output.AppendLine(8, $"public static {className} Default() => new {className}({string.Join(", ", defaultValues)});"); + output.AppendLine(8, $"public static {className} Default() => new {className}({string.Join(", ", defaultValues)})"); + output.AppendLine(8, "{"); + var requiredProperties = propertiesPublicSettable.GetRequiredPropertiesAsAssignments(); + output.AppendLines(12, requiredProperties, ","); + output.AppendLine(8, "};"); return output.ToString(); } diff --git a/src/FluentBuilderGenerator/Helpers/DefaultValueHelper.cs b/src/FluentBuilderGenerator/Helpers/DefaultValueHelper.cs index 94b5ffb..c0e7071 100644 --- a/src/FluentBuilderGenerator/Helpers/DefaultValueHelper.cs +++ b/src/FluentBuilderGenerator/Helpers/DefaultValueHelper.cs @@ -1,4 +1,5 @@ using FluentBuilderGenerator.Extensions; +using FluentBuilderGenerator.Models; using FluentBuilderGenerator.Types; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; @@ -134,6 +135,11 @@ private static string GetNewConstructor(ITypeSymbol typeSymbol) var constructorParameters = bestMatchingConstructor.Parameters.Select(parameter => GetDefault(parameter.Type)); - return $"new {typeSymbol}({string.Join(", ", constructorParameters)})"; + var publicRequiredSetProperties = typeSymbol.GetMembers().OfType() + .Where(p => p.IsRequired) + .Where(x => x.SetMethod is not null) + .Where(x => x.CanBeReferencedByName); + + return $"new {typeSymbol}({string.Join(", ", constructorParameters)}) {{ {string.Join(", ", publicRequiredSetProperties.GetRequiredPropertiesAsAssignments())} }}"; } } \ No newline at end of file diff --git a/src/FluentBuilderGenerator/Interfaces/IPropertyOrParameterSymbol.cs b/src/FluentBuilderGenerator/Interfaces/IPropertyOrParameterSymbol.cs index 19f2902..d788f59 100644 --- a/src/FluentBuilderGenerator/Interfaces/IPropertyOrParameterSymbol.cs +++ b/src/FluentBuilderGenerator/Interfaces/IPropertyOrParameterSymbol.cs @@ -14,4 +14,6 @@ internal interface IPropertyOrParameterSymbol ITypeSymbol Type { get; } bool ExcludeFromIsSetLogic { get; } + + bool Required { get; } } \ No newline at end of file diff --git a/src/FluentBuilderGenerator/Models/PropertyOrParameterSymbol.cs b/src/FluentBuilderGenerator/Models/PropertyOrParameterSymbol.cs index 17f1f93..7a3c214 100644 --- a/src/FluentBuilderGenerator/Models/PropertyOrParameterSymbol.cs +++ b/src/FluentBuilderGenerator/Models/PropertyOrParameterSymbol.cs @@ -4,7 +4,7 @@ namespace FluentBuilderGenerator.Models; -internal record PropertyOrParameterSymbol(ISymbol Symbol, ITypeSymbol Type, bool ExcludeFromIsSetLogic) : IPropertyOrParameterSymbol +internal record PropertyOrParameterSymbol(ISymbol Symbol, ITypeSymbol Type, bool ExcludeFromIsSetLogic, bool Required) : IPropertyOrParameterSymbol { public PropertyType PropertyType => Symbol is IPropertySymbol ? PropertyType.Property : PropertyType.Parameter; diff --git a/tests/FluentBuilderGeneratorTests/DTO/AbcTest.OtherNamespace.ClassOnOtherNamespaceBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/AbcTest.OtherNamespace.ClassOnOtherNamespaceBuilder.g.cs index 6319e08..2467ab3 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/AbcTest.OtherNamespace.ClassOnOtherNamespaceBuilder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/AbcTest.OtherNamespace.ClassOnOtherNamespaceBuilder.g.cs @@ -38,7 +38,10 @@ public ClassOnOtherNamespaceBuilder WithId(Func func) } private bool _Constructor1204632294_IsSet; - private Lazy _Constructor1204632294 = new Lazy(() => new AbcTest.OtherNamespace.ClassOnOtherNamespace()); + private Lazy _Constructor1204632294 = new Lazy(() => new AbcTest.OtherNamespace.ClassOnOtherNamespace() + { + + }); public ClassOnOtherNamespaceBuilder UsingConstructor() { _Constructor1204632294 = new Lazy(() => @@ -46,7 +49,10 @@ public ClassOnOtherNamespaceBuilder UsingConstructor() return new AbcTest.OtherNamespace.ClassOnOtherNamespace ( - ); + ) + { + + }; }); _Constructor1204632294_IsSet = true; @@ -95,7 +101,10 @@ public override ClassOnOtherNamespace Build(bool useObjectInitializer) return Instance.Value; } - public static ClassOnOtherNamespace Default() => new ClassOnOtherNamespace(); + public static ClassOnOtherNamespace Default() => new ClassOnOtherNamespace() + { + + }; } } diff --git a/tests/FluentBuilderGeneratorTests/DTO/BuilderGeneratorTests.DTO.AddressBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/BuilderGeneratorTests.DTO.AddressBuilder.g.cs index 24f7802..2af6f28 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/BuilderGeneratorTests.DTO.AddressBuilder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/BuilderGeneratorTests.DTO.AddressBuilder.g.cs @@ -76,7 +76,7 @@ public AddressBuilder WithArray2(Action _thingUsingConstructorWithItself = new Lazy(() => new FluentBuilderGeneratorTests.DTO.ThingUsingConstructorWithItself(string.Empty, string.Empty)); + private Lazy _thingUsingConstructorWithItself = new Lazy(() => new FluentBuilderGeneratorTests.DTO.ThingUsingConstructorWithItself(string.Empty, string.Empty) { }); public AddressBuilder WithThingUsingConstructorWithItself(FluentBuilderGeneratorTests.DTO.ThingUsingConstructorWithItself value) => WithThingUsingConstructorWithItself(() => value); public AddressBuilder WithThingUsingConstructorWithItself(Func func) { @@ -85,7 +85,7 @@ public AddressBuilder WithThingUsingConstructorWithItself(Func _thingUsingConstructorWith2Parameters = new Lazy(() => new FluentBuilderGeneratorTests.DTO.ThingUsingConstructorWith2Parameters(default(int), default(int))); + private Lazy _thingUsingConstructorWith2Parameters = new Lazy(() => new FluentBuilderGeneratorTests.DTO.ThingUsingConstructorWith2Parameters(default(int), default(int)) { }); public AddressBuilder WithThingUsingConstructorWith2Parameters(FluentBuilderGeneratorTests.DTO.ThingUsingConstructorWith2Parameters value) => WithThingUsingConstructorWith2Parameters(() => value); public AddressBuilder WithThingUsingConstructorWith2Parameters(Func func) { @@ -94,7 +94,7 @@ public AddressBuilder WithThingUsingConstructorWith2Parameters(Func _thingWithoutDefaultConstructor = new Lazy(() => new FluentBuilderGeneratorTests.DTO.ThingWithoutDefaultConstructor(default(int))); + private Lazy _thingWithoutDefaultConstructor = new Lazy(() => new FluentBuilderGeneratorTests.DTO.ThingWithoutDefaultConstructor(default(int)) { }); public AddressBuilder WithThingWithoutDefaultConstructor(FluentBuilderGeneratorTests.DTO.ThingWithoutDefaultConstructor value) => WithThingWithoutDefaultConstructor(() => value); public AddressBuilder WithThingWithoutDefaultConstructor(Func func) { @@ -112,7 +112,7 @@ public AddressBuilder WithThingWithPrivateConstructor(Func _thing = new Lazy(() => new FluentBuilderGeneratorTests.DTO.Thing()); + private Lazy _thing = new Lazy(() => new FluentBuilderGeneratorTests.DTO.Thing() { }); public AddressBuilder WithThing(FluentBuilderGeneratorTests.DTO.Thing value) => WithThing(() => value); public AddressBuilder WithThing(Func func) { @@ -344,7 +344,10 @@ public AddressBuilder WithDictionary2(Action _Constructor_1362952513 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.Address()); + private Lazy _Constructor_1362952513 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.Address() + { + + }); public AddressBuilder UsingConstructor() { _Constructor_1362952513 = new Lazy(() => @@ -352,7 +355,10 @@ public AddressBuilder UsingConstructor() return new FluentBuilderGeneratorTests.DTO.Address ( - ); + ) + { + + }; }); _Constructor_1362952513_IsSet = true; @@ -449,7 +455,10 @@ public override Address Build(bool useObjectInitializer) return Instance.Value; } - public static Address Default() => new Address(); + public static Address Default() => new Address() + { + + }; } } diff --git a/tests/FluentBuilderGeneratorTests/DTO/ClassWithInitProperties.cs b/tests/FluentBuilderGeneratorTests/DTO/ClassWithInitProperties.cs index 1395a71..d7a9240 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/ClassWithInitProperties.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/ClassWithInitProperties.cs @@ -9,5 +9,16 @@ public class ClassWithInitProperties public string ProductName { get; init; } public string PrivateProductName { get; private init; } + + public required string RequiredTest { get; set; } + + public required string RequiredTestInit { get; init; } + + public required ClassWithInitProperties2 X { get; init; } + } + + public class ClassWithInitProperties2 + { + public required string X { get; set; } } } \ No newline at end of file diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.AddressBuilder_T_.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.AddressBuilder_T_.g.cs index 8bd00e6..649ae12 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.AddressBuilder_T_.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.AddressBuilder_T_.g.cs @@ -38,7 +38,10 @@ public AddressBuilder WithStreet(Func func) } private bool _Constructor478882805_IsSet; - private Lazy> _Constructor478882805 = new Lazy>(() => new FluentBuilderGeneratorTests.DTO.Address()); + private Lazy> _Constructor478882805 = new Lazy>(() => new FluentBuilderGeneratorTests.DTO.Address() + { + + }); public AddressBuilder UsingConstructor() { _Constructor478882805 = new Lazy>(() => @@ -46,7 +49,10 @@ public AddressBuilder UsingConstructor() return new FluentBuilderGeneratorTests.DTO.Address ( - ); + ) + { + + }; }); _Constructor478882805_IsSet = true; @@ -95,7 +101,10 @@ public override Address Build(bool useObjectInitializer) return Instance.Value; } - public static Address Default() => new Address(); + public static Address Default() => new Address() + { + + }; } } diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.AddressTTBuilder_T1_T2_.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.AddressTTBuilder_T1_T2_.g.cs index 57e124a..cd3dec1 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.AddressTTBuilder_T1_T2_.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.AddressTTBuilder_T1_T2_.g.cs @@ -47,7 +47,10 @@ public AddressTTBuilder WithTestValue2(Func func) } private bool _Constructor_758958168_IsSet; - private Lazy> _Constructor_758958168 = new Lazy>(() => new FluentBuilderGeneratorTests.DTO.AddressTT()); + private Lazy> _Constructor_758958168 = new Lazy>(() => new FluentBuilderGeneratorTests.DTO.AddressTT() + { + + }); public AddressTTBuilder UsingConstructor() { _Constructor_758958168 = new Lazy>(() => @@ -55,7 +58,10 @@ public AddressTTBuilder UsingConstructor() return new FluentBuilderGeneratorTests.DTO.AddressTT ( - ); + ) + { + + }; }); _Constructor_758958168_IsSet = true; @@ -106,7 +112,10 @@ public override AddressTT Build(bool useObjectInitializer) return Instance.Value; } - public static AddressTT Default() => new AddressTT(); + public static AddressTT Default() => new AddressTT() + { + + }; } } diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithFuncAndActionBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithFuncAndActionBuilder.g.cs index 57a4151..0575002 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithFuncAndActionBuilder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithFuncAndActionBuilder.g.cs @@ -65,7 +65,10 @@ public ClassWithFuncAndActionBuilder WithAction(Func> func) } private bool _Constructor_1844167085_IsSet; - private Lazy _Constructor_1844167085 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.ClassWithFuncAndAction()); + private Lazy _Constructor_1844167085 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.ClassWithFuncAndAction() + { + + }); public ClassWithFuncAndActionBuilder UsingConstructor() { _Constructor_1844167085 = new Lazy(() => @@ -73,7 +76,10 @@ public ClassWithFuncAndActionBuilder UsingConstructor() return new FluentBuilderGeneratorTests.DTO.ClassWithFuncAndAction ( - ); + ) + { + + }; }); _Constructor_1844167085_IsSet = true; @@ -128,7 +134,10 @@ public override ClassWithFuncAndAction Build(bool useObjectInitializer) return Instance.Value; } - public static ClassWithFuncAndAction Default() => new ClassWithFuncAndAction(); + public static ClassWithFuncAndAction Default() => new ClassWithFuncAndAction() + { + + }; } } diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithInitPropertiesBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithInitPropertiesBuilder.g.cs index df72e55..34b1920 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithInitPropertiesBuilder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithInitPropertiesBuilder.g.cs @@ -50,9 +50,37 @@ public ClassWithInitPropertiesBuilder WithProductName(Func func) _productName = new Lazy(func); return this; } + private bool _requiredTestIsSet; + private Lazy _requiredTest = new Lazy(() => string.Empty); + public ClassWithInitPropertiesBuilder WithRequiredTest(string value) => WithRequiredTest(() => value); + public ClassWithInitPropertiesBuilder WithRequiredTest(Func func) + { + _requiredTest = new Lazy(func); + _requiredTestIsSet = true; + return this; + } + private Lazy _requiredTestInit = new Lazy(() => string.Empty); + public ClassWithInitPropertiesBuilder WithRequiredTestInit(string value) => WithRequiredTestInit(() => value); + public ClassWithInitPropertiesBuilder WithRequiredTestInit(Func func) + { + _requiredTestInit = new Lazy(func); + return this; + } + private Lazy _x = new Lazy(() => new FluentBuilderGeneratorTests.DTO.ClassWithInitProperties2() { X = string.Empty }); + public ClassWithInitPropertiesBuilder WithX(FluentBuilderGeneratorTests.DTO.ClassWithInitProperties2 value) => WithX(() => value); + public ClassWithInitPropertiesBuilder WithX(Func func) + { + _x = new Lazy(func); + return this; + } private bool _Constructor1040722879_IsSet; - private Lazy _Constructor1040722879 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.ClassWithInitProperties()); + private Lazy _Constructor1040722879 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.ClassWithInitProperties() + { + RequiredTest = string.Empty, + RequiredTestInit = string.Empty, + X = new FluentBuilderGeneratorTests.DTO.ClassWithInitProperties2() { X = string.Empty } + }); public ClassWithInitPropertiesBuilder UsingConstructor() { _Constructor1040722879 = new Lazy(() => @@ -60,7 +88,12 @@ public ClassWithInitPropertiesBuilder UsingConstructor() return new FluentBuilderGeneratorTests.DTO.ClassWithInitProperties ( - ); + ) + { + RequiredTest = string.Empty, + RequiredTestInit = string.Empty, + X = new FluentBuilderGeneratorTests.DTO.ClassWithInitProperties2() { X = string.Empty } + }; }); _Constructor1040722879_IsSet = true; @@ -91,7 +124,10 @@ public override ClassWithInitProperties Build(bool useObjectInitializer) { Normal = _normal.Value, SiteId = _siteId.Value, - ProductName = _productName.Value + ProductName = _productName.Value, + RequiredTest = _requiredTest.Value, + RequiredTestInit = _requiredTestInit.Value, + X = _x.Value }; return instance; @@ -105,13 +141,19 @@ public override ClassWithInitProperties Build(bool useObjectInitializer) } if (_normalIsSet) { Instance.Value.Normal = _normal.Value; } + if (_requiredTestIsSet) { Instance.Value.RequiredTest = _requiredTest.Value; } PostBuild(Instance.Value); return Instance.Value; } - public static ClassWithInitProperties Default() => new ClassWithInitProperties(); + public static ClassWithInitProperties Default() => new ClassWithInitProperties() + { + RequiredTest = string.Empty, + RequiredTestInit = string.Empty, + X = new FluentBuilderGeneratorTests.DTO.ClassWithInitProperties2() { X = string.Empty } + }; } } diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPrimaryConstructorBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPrimaryConstructorBuilder.g.cs index e84cc1c..4723e8a 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPrimaryConstructorBuilder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPrimaryConstructorBuilder.g.cs @@ -52,7 +52,10 @@ public ClassWithPrimaryConstructorBuilder WithNormal(Func func) } private bool _Constructor827069805_IsSet; - private Lazy _Constructor827069805 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.ClassWithPrimaryConstructor(string.Empty, default(int))); + private Lazy _Constructor827069805 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.ClassWithPrimaryConstructor(string.Empty,default(int)) + { + + }); public ClassWithPrimaryConstructorBuilder UsingConstructor(string test, int num) { _Constructor827069805 = new Lazy(() => @@ -61,7 +64,10 @@ public ClassWithPrimaryConstructorBuilder UsingConstructor(string test, int num) ( test, num - ); + ) + { + + }; }); _Constructor827069805_IsSet = true; @@ -105,7 +111,10 @@ public override ClassWithPrimaryConstructor Build(bool useObjectInitializer) return Instance.Value; } - public static ClassWithPrimaryConstructor Default() => new ClassWithPrimaryConstructor(string.Empty, default(int)); + public static ClassWithPrimaryConstructor Default() => new ClassWithPrimaryConstructor(string.Empty, default(int)) + { + + }; } } diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPrivateSetter1Builder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPrivateSetter1Builder.g.cs index c30f976..a855c3c 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPrivateSetter1Builder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPrivateSetter1Builder.g.cs @@ -47,7 +47,10 @@ public ClassWithPrivateSetter1Builder WithValue1(Func func) } private bool _Constructor126242367_IsSet; - private Lazy _Constructor126242367 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.ClassWithPrivateSetter1()); + private Lazy _Constructor126242367 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.ClassWithPrivateSetter1() + { + + }); public ClassWithPrivateSetter1Builder UsingConstructor() { _Constructor126242367 = new Lazy(() => @@ -55,7 +58,10 @@ public ClassWithPrivateSetter1Builder UsingConstructor() return new FluentBuilderGeneratorTests.DTO.ClassWithPrivateSetter1 ( - ); + ) + { + + }; }); _Constructor126242367_IsSet = true; @@ -109,7 +115,10 @@ public override ClassWithPrivateSetter1 Build(bool useObjectInitializer) return Instance.Value; } - public static ClassWithPrivateSetter1 Default() => new ClassWithPrivateSetter1(); + public static ClassWithPrivateSetter1 Default() => new ClassWithPrivateSetter1() + { + + }; } } diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPrivateSetter2Builder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPrivateSetter2Builder.g.cs index ccb421c..d244e10 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPrivateSetter2Builder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPrivateSetter2Builder.g.cs @@ -38,7 +38,10 @@ public ClassWithPrivateSetter2Builder WithValue2(Func func) } private bool _Constructor1164815551_IsSet; - private Lazy _Constructor1164815551 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.ClassWithPrivateSetter2()); + private Lazy _Constructor1164815551 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.ClassWithPrivateSetter2() + { + + }); public ClassWithPrivateSetter2Builder UsingConstructor() { _Constructor1164815551 = new Lazy(() => @@ -46,7 +49,10 @@ public ClassWithPrivateSetter2Builder UsingConstructor() return new FluentBuilderGeneratorTests.DTO.ClassWithPrivateSetter2 ( - ); + ) + { + + }; }); _Constructor1164815551_IsSet = true; @@ -95,7 +101,10 @@ public override ClassWithPrivateSetter2 Build(bool useObjectInitializer) return Instance.Value; } - public static ClassWithPrivateSetter2 Default() => new ClassWithPrivateSetter2(); + public static ClassWithPrivateSetter2 Default() => new ClassWithPrivateSetter2() + { + + }; } } diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPropertyValueSetBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPropertyValueSetBuilder.g.cs index 3f820b5..b77480f 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPropertyValueSetBuilder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPropertyValueSetBuilder.g.cs @@ -131,7 +131,10 @@ public ClassWithPropertyValueSetBuilder WithStringEmpty(Func func) } private bool _Constructor_1318089537_IsSet; - private Lazy _Constructor_1318089537 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.ClassWithPropertyValueSet()); + private Lazy _Constructor_1318089537 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.ClassWithPropertyValueSet() + { + + }); public ClassWithPropertyValueSetBuilder UsingConstructor() { _Constructor_1318089537 = new Lazy(() => @@ -139,7 +142,10 @@ public ClassWithPropertyValueSetBuilder UsingConstructor() return new FluentBuilderGeneratorTests.DTO.ClassWithPropertyValueSet ( - ); + ) + { + + }; }); _Constructor_1318089537_IsSet = true; @@ -208,7 +214,10 @@ public override ClassWithPropertyValueSet Build(bool useObjectInitializer) return Instance.Value; } - public static ClassWithPropertyValueSet Default() => new ClassWithPropertyValueSet(); + public static ClassWithPropertyValueSet Default() => new ClassWithPropertyValueSet() + { + + }; } } diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.InternalClassBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.InternalClassBuilder.g.cs index e6afddf..69f9597 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.InternalClassBuilder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.InternalClassBuilder.g.cs @@ -38,7 +38,10 @@ public InternalClassBuilder WithId(Func func) } private bool _Constructor_1847127841_IsSet; - private Lazy _Constructor_1847127841 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.InternalClass()); + private Lazy _Constructor_1847127841 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.InternalClass() + { + + }); public InternalClassBuilder UsingConstructor() { _Constructor_1847127841 = new Lazy(() => @@ -46,7 +49,10 @@ public InternalClassBuilder UsingConstructor() return new FluentBuilderGeneratorTests.DTO.InternalClass ( - ); + ) + { + + }; }); _Constructor_1847127841_IsSet = true; @@ -95,7 +101,10 @@ public override InternalClass Build(bool useObjectInitializer) return Instance.Value; } - public static InternalClass Default() => new InternalClass(); + public static InternalClass Default() => new InternalClass() + { + + }; } } diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.MyDummyClassBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.MyDummyClassBuilder.g.cs index 5848b05..9b4d114 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.MyDummyClassBuilder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.MyDummyClassBuilder.g.cs @@ -38,7 +38,10 @@ public MyDummyClassBuilder WithId(Func func) } private bool _Constructor921673711_IsSet; - private Lazy _Constructor921673711 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.DummyClass()); + private Lazy _Constructor921673711 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.DummyClass() + { + + }); public MyDummyClassBuilder UsingConstructor() { _Constructor921673711 = new Lazy(() => @@ -46,7 +49,10 @@ public MyDummyClassBuilder UsingConstructor() return new FluentBuilderGeneratorTests.DTO.DummyClass ( - ); + ) + { + + }; }); _Constructor921673711_IsSet = true; @@ -95,7 +101,10 @@ public override DummyClass Build(bool useObjectInitializer) return Instance.Value; } - public static DummyClass Default() => new DummyClass(); + public static DummyClass Default() => new DummyClass() + { + + }; } } diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.MyInternalClassBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.MyInternalClassBuilder.g.cs index 950017f..40a6524 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.MyInternalClassBuilder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.MyInternalClassBuilder.g.cs @@ -38,7 +38,10 @@ public MyInternalClassBuilder WithId(Func func) } private bool _Constructor_1847127841_IsSet; - private Lazy _Constructor_1847127841 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.InternalClass()); + private Lazy _Constructor_1847127841 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.InternalClass() + { + + }); public MyInternalClassBuilder UsingConstructor() { _Constructor_1847127841 = new Lazy(() => @@ -46,7 +49,10 @@ public MyInternalClassBuilder UsingConstructor() return new FluentBuilderGeneratorTests.DTO.InternalClass ( - ); + ) + { + + }; }); _Constructor_1847127841_IsSet = true; @@ -95,7 +101,10 @@ public override InternalClass Build(bool useObjectInitializer) return Instance.Value; } - public static InternalClass Default() => new InternalClass(); + public static InternalClass Default() => new InternalClass() + { + + }; } } diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.RecordWithPrimaryConstructorBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.RecordWithPrimaryConstructorBuilder.g.cs index dcb1e77..647625a 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.RecordWithPrimaryConstructorBuilder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.RecordWithPrimaryConstructorBuilder.g.cs @@ -52,7 +52,10 @@ public RecordWithPrimaryConstructorBuilder WithNormal(Func func) } private bool _Constructor_380013639_IsSet; - private Lazy _Constructor_380013639 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.RecordWithPrimaryConstructor(string.Empty, default(int))); + private Lazy _Constructor_380013639 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.RecordWithPrimaryConstructor(string.Empty,default(int)) + { + + }); public RecordWithPrimaryConstructorBuilder UsingConstructor(string Test, int Num) { _Constructor_380013639 = new Lazy(() => @@ -61,7 +64,10 @@ public RecordWithPrimaryConstructorBuilder UsingConstructor(string Test, int Num ( Test, Num - ); + ) + { + + }; }); _Constructor_380013639_IsSet = true; @@ -105,7 +111,10 @@ public override RecordWithPrimaryConstructor Build(bool useObjectInitializer) return Instance.Value; } - public static RecordWithPrimaryConstructor Default() => new RecordWithPrimaryConstructor(string.Empty, default(int)); + public static RecordWithPrimaryConstructor Default() => new RecordWithPrimaryConstructor(string.Empty, default(int)) + { + + }; } } diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.TestBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.TestBuilder.g.cs index 75bd9ef..35c2bbd 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.TestBuilder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.TestBuilder.g.cs @@ -44,7 +44,10 @@ public TestBuilder WithClassOnOtherNamespaceList(Action _Constructor1204588943 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.Test()); + private Lazy _Constructor1204588943 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.Test() + { + + }); public TestBuilder UsingConstructor() { _Constructor1204588943 = new Lazy(() => @@ -52,7 +55,10 @@ public TestBuilder UsingConstructor() return new FluentBuilderGeneratorTests.DTO.Test ( - ); + ) + { + + }; }); _Constructor1204588943_IsSet = true; @@ -101,7 +107,10 @@ public override Test Build(bool useObjectInitializer) return Instance.Value; } - public static Test Default() => new Test(); + public static Test Default() => new Test() + { + + }; } } diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ThingBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ThingBuilder.g.cs index ee78e08..4a99e38 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ThingBuilder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ThingBuilder.g.cs @@ -28,7 +28,7 @@ public static ThingBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.Thing public partial class ThingBuilder : Builder { private bool _tIsSet; - private Lazy _t = new Lazy(() => new FluentBuilderGeneratorTests.DTO.Thing()); + private Lazy _t = new Lazy(() => new FluentBuilderGeneratorTests.DTO.Thing() { }); public ThingBuilder WithT(FluentBuilderGeneratorTests.DTO.Thing value) => WithT(() => value); public ThingBuilder WithT(Func func) { @@ -44,7 +44,10 @@ public ThingBuilder WithT(Action a }); private bool _Constructor_759650433_IsSet; - private Lazy _Constructor_759650433 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.Thing()); + private Lazy _Constructor_759650433 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.Thing() + { + + }); public ThingBuilder UsingConstructor() { _Constructor_759650433 = new Lazy(() => @@ -52,7 +55,10 @@ public ThingBuilder UsingConstructor() return new FluentBuilderGeneratorTests.DTO.Thing ( - ); + ) + { + + }; }); _Constructor_759650433_IsSet = true; @@ -101,7 +107,10 @@ public override Thing Build(bool useObjectInitializer) return Instance.Value; } - public static Thing Default() => new Thing(); + public static Thing Default() => new Thing() + { + + }; } } diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserBuilder.g.cs index 925de4d..1abb1cf 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserBuilder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserBuilder.g.cs @@ -55,7 +55,7 @@ public UserBuilder WithQuitDate(Func func) return this; } private bool _testDummyClassIsSet; - private Lazy _testDummyClass = new Lazy(() => new FluentBuilderGeneratorTests.DTO.DummyClass()); + private Lazy _testDummyClass = new Lazy(() => new FluentBuilderGeneratorTests.DTO.DummyClass() { }); public UserBuilder WithTestDummyClass(FluentBuilderGeneratorTests.DTO.DummyClass value) => WithTestDummyClass(() => value); public UserBuilder WithTestDummyClass(Func func) { @@ -86,7 +86,10 @@ public UserBuilder WithOptions(Action _Constructor_1436654309 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.User()); + private Lazy _Constructor_1436654309 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.User() + { + + }); public UserBuilder UsingConstructor() { _Constructor_1436654309 = new Lazy(() => @@ -94,7 +97,10 @@ public UserBuilder UsingConstructor() return new FluentBuilderGeneratorTests.DTO.User ( - ); + ) + { + + }; }); _Constructor_1436654309_IsSet = true; @@ -151,7 +157,10 @@ public override User Build(bool useObjectInitializer) return Instance.Value; } - public static User Default() => new User(); + public static User Default() => new User() + { + + }; } } diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserTBuilder_T_.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserTBuilder_T_.g.cs index 82233c2..e0fb53e 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserTBuilder_T_.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserTBuilder_T_.g.cs @@ -38,7 +38,10 @@ public UserTBuilder WithTValue(Func func) } private bool _Constructor302462813_IsSet; - private Lazy> _Constructor302462813 = new Lazy>(() => new FluentBuilderGeneratorTests.DTO.UserT()); + private Lazy> _Constructor302462813 = new Lazy>(() => new FluentBuilderGeneratorTests.DTO.UserT() + { + + }); public UserTBuilder UsingConstructor() { _Constructor302462813 = new Lazy>(() => @@ -46,7 +49,10 @@ public UserTBuilder UsingConstructor() return new FluentBuilderGeneratorTests.DTO.UserT ( - ); + ) + { + + }; }); _Constructor302462813_IsSet = true; @@ -95,7 +101,10 @@ public override UserT Build(bool useObjectInitializer) return Instance.Value; } - public static UserT Default() => new UserT(); + public static UserT Default() => new UserT() + { + + }; } } diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserTWithAddressAndConstructorBuilder_T_.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserTWithAddressAndConstructorBuilder_T_.g.cs index 1304c06..4205a92 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserTWithAddressAndConstructorBuilder_T_.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserTWithAddressAndConstructorBuilder_T_.g.cs @@ -37,7 +37,7 @@ public UserTWithAddressAndConstructorBuilder WithTValue(Func func) return this; } private bool _addressIsSet; - private Lazy> _address = new Lazy>(() => new FluentBuilderGeneratorTests.DTO.Address()); + private Lazy> _address = new Lazy>(() => new FluentBuilderGeneratorTests.DTO.Address() { }); public UserTWithAddressAndConstructorBuilder WithAddress(FluentBuilderGeneratorTests.DTO.Address value) => WithAddress(() => value); public UserTWithAddressAndConstructorBuilder WithAddress(Func> func) { @@ -53,7 +53,10 @@ public UserTWithAddressAndConstructorBuilder WithAddress(Action> _Constructor1978124393 = new Lazy>(() => new FluentBuilderGeneratorTests.DTO.UserTWithAddressAndConstructor()); + private Lazy> _Constructor1978124393 = new Lazy>(() => new FluentBuilderGeneratorTests.DTO.UserTWithAddressAndConstructor() + { + + }); public UserTWithAddressAndConstructorBuilder UsingConstructor() { _Constructor1978124393 = new Lazy>(() => @@ -61,7 +64,10 @@ public UserTWithAddressAndConstructorBuilder UsingConstructor() return new FluentBuilderGeneratorTests.DTO.UserTWithAddressAndConstructor ( - ); + ) + { + + }; }); _Constructor1978124393_IsSet = true; @@ -112,7 +118,10 @@ public override UserTWithAddressAndConstructor Build(bool useObjectInitialize return Instance.Value; } - public static UserTWithAddressAndConstructor Default() => new UserTWithAddressAndConstructor(); + public static UserTWithAddressAndConstructor Default() => new UserTWithAddressAndConstructor() + { + + }; } } diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserTWithAddressTBuilder_T_.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserTWithAddressTBuilder_T_.g.cs index 81432e0..adf80e8 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserTWithAddressTBuilder_T_.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserTWithAddressTBuilder_T_.g.cs @@ -37,7 +37,7 @@ public UserTWithAddressTBuilder WithTValue(Func func) return this; } private bool _addressIsSet; - private Lazy> _address = new Lazy>(() => new FluentBuilderGeneratorTests.DTO.Address()); + private Lazy> _address = new Lazy>(() => new FluentBuilderGeneratorTests.DTO.Address() { }); public UserTWithAddressTBuilder WithAddress(FluentBuilderGeneratorTests.DTO.Address value) => WithAddress(() => value); public UserTWithAddressTBuilder WithAddress(Func> func) { @@ -53,7 +53,10 @@ public UserTWithAddressTBuilder WithAddress(Action> _Constructor1691800221 = new Lazy>(() => new FluentBuilderGeneratorTests.DTO.UserTWithAddressT()); + private Lazy> _Constructor1691800221 = new Lazy>(() => new FluentBuilderGeneratorTests.DTO.UserTWithAddressT() + { + + }); public UserTWithAddressTBuilder UsingConstructor() { _Constructor1691800221 = new Lazy>(() => @@ -61,7 +64,10 @@ public UserTWithAddressTBuilder UsingConstructor() return new FluentBuilderGeneratorTests.DTO.UserTWithAddressT ( - ); + ) + { + + }; }); _Constructor1691800221_IsSet = true; @@ -112,7 +118,10 @@ public override UserTWithAddressT Build(bool useObjectInitializer) return Instance.Value; } - public static UserTWithAddressT Default() => new UserTWithAddressT(); + public static UserTWithAddressT Default() => new UserTWithAddressT() + { + + }; } } diff --git a/tests/FluentBuilderGeneratorTests/DTO2/FluentBuilderGeneratorTests.DTO2.MyOptionBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO2/FluentBuilderGeneratorTests.DTO2.MyOptionBuilder.g.cs index 247c2f6..adb8b35 100644 --- a/tests/FluentBuilderGeneratorTests/DTO2/FluentBuilderGeneratorTests.DTO2.MyOptionBuilder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO2/FluentBuilderGeneratorTests.DTO2.MyOptionBuilder.g.cs @@ -38,7 +38,10 @@ public MyOptionBuilder WithName(Func func) } private bool _Constructor155259363_IsSet; - private Lazy _Constructor155259363 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.Option()); + private Lazy _Constructor155259363 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.Option() + { + + }); public MyOptionBuilder UsingConstructor() { _Constructor155259363 = new Lazy(() => @@ -46,7 +49,10 @@ public MyOptionBuilder UsingConstructor() return new FluentBuilderGeneratorTests.DTO.Option ( - ); + ) + { + + }; }); _Constructor155259363_IsSet = true; @@ -95,7 +101,10 @@ public override Option Build(bool useObjectInitializer) return Instance.Value; } - public static Option Default() => new Option(); + public static Option Default() => new Option() + { + + }; } }