diff --git a/src/BuilderGenerator.IntegrationTests.Net60/Builders/CollectionTypeSampleBuilder.cs b/src/BuilderGenerator.IntegrationTests.Net60/Builders/CollectionTypeSampleBuilder.cs
deleted file mode 100644
index 0b0b23b..0000000
--- a/src/BuilderGenerator.IntegrationTests.Net60/Builders/CollectionTypeSampleBuilder.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using BuilderGenerator.IntegrationTests.Core.Models.Entities;
-
-namespace BuilderGenerator.IntegrationTests.Net60.Builders;
-
-[BuilderFor(typeof(CollectionTypesSample))]
-public partial class CollectionTypeSampleBuilder
-{
-}
diff --git a/src/BuilderGenerator.IntegrationTests.Core/BuilderGenerator.IntegrationTests.Core.csproj b/src/BuilderGenerator.Tests.Core/BuilderGenerator.Tests.Core.csproj
similarity index 76%
rename from src/BuilderGenerator.IntegrationTests.Core/BuilderGenerator.IntegrationTests.Core.csproj
rename to src/BuilderGenerator.Tests.Core/BuilderGenerator.Tests.Core.csproj
index d87e22c..b9bf28e 100644
--- a/src/BuilderGenerator.IntegrationTests.Core/BuilderGenerator.IntegrationTests.Core.csproj
+++ b/src/BuilderGenerator.Tests.Core/BuilderGenerator.Tests.Core.csproj
@@ -7,10 +7,10 @@
- <_Parameter1>BuilderGenerator.IntegrationTests.Net60
+ <_Parameter1>BuilderGenerator.Tests.Integration.Net60
- <_Parameter1>BuilderGenerator.IntegrationTests.Net60
+ <_Parameter1>BuilderGenerator.Tests.Integration.Net60
\ No newline at end of file
diff --git a/src/BuilderGenerator.IntegrationTests.Core/Models/Entities/AuditableEntity.cs b/src/BuilderGenerator.Tests.Core/Models/Entities/AuditableEntity.cs
similarity index 78%
rename from src/BuilderGenerator.IntegrationTests.Core/Models/Entities/AuditableEntity.cs
rename to src/BuilderGenerator.Tests.Core/Models/Entities/AuditableEntity.cs
index 83911cf..1a37cfe 100644
--- a/src/BuilderGenerator.IntegrationTests.Core/Models/Entities/AuditableEntity.cs
+++ b/src/BuilderGenerator.Tests.Core/Models/Entities/AuditableEntity.cs
@@ -1,6 +1,6 @@
using System;
-namespace BuilderGenerator.IntegrationTests.Core.Models.Entities;
+namespace BuilderGenerator.Tests.Core.Models.Entities;
public abstract class AuditableEntity : Entity
{
diff --git a/src/BuilderGenerator.IntegrationTests.Core/Models/Entities/CollectionTypesSample.cs b/src/BuilderGenerator.Tests.Core/Models/Entities/CollectionTypesSample.cs
similarity index 92%
rename from src/BuilderGenerator.IntegrationTests.Core/Models/Entities/CollectionTypesSample.cs
rename to src/BuilderGenerator.Tests.Core/Models/Entities/CollectionTypesSample.cs
index fa4142c..ca9a990 100644
--- a/src/BuilderGenerator.IntegrationTests.Core/Models/Entities/CollectionTypesSample.cs
+++ b/src/BuilderGenerator.Tests.Core/Models/Entities/CollectionTypesSample.cs
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
-namespace BuilderGenerator.IntegrationTests.Core.Models.Entities;
+namespace BuilderGenerator.Tests.Core.Models.Entities;
public class CollectionTypesSample
{
diff --git a/src/BuilderGenerator.IntegrationTests.Core/Models/Entities/Entity.cs b/src/BuilderGenerator.Tests.Core/Models/Entities/Entity.cs
similarity index 77%
rename from src/BuilderGenerator.IntegrationTests.Core/Models/Entities/Entity.cs
rename to src/BuilderGenerator.Tests.Core/Models/Entities/Entity.cs
index 1ec6595..8c18971 100644
--- a/src/BuilderGenerator.IntegrationTests.Core/Models/Entities/Entity.cs
+++ b/src/BuilderGenerator.Tests.Core/Models/Entities/Entity.cs
@@ -1,6 +1,6 @@
using System;
-namespace BuilderGenerator.IntegrationTests.Core.Models.Entities;
+namespace BuilderGenerator.Tests.Core.Models.Entities;
public abstract class Entity
{
diff --git a/src/BuilderGenerator.IntegrationTests.Core/Models/Entities/Order.cs b/src/BuilderGenerator.Tests.Core/Models/Entities/Order.cs
similarity index 73%
rename from src/BuilderGenerator.IntegrationTests.Core/Models/Entities/Order.cs
rename to src/BuilderGenerator.Tests.Core/Models/Entities/Order.cs
index 90ed37b..e830668 100644
--- a/src/BuilderGenerator.IntegrationTests.Core/Models/Entities/Order.cs
+++ b/src/BuilderGenerator.Tests.Core/Models/Entities/Order.cs
@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
-using BuilderGenerator.IntegrationTests.Core.Models.Enums;
+using BuilderGenerator.Tests.Core.Models.Enums;
-namespace BuilderGenerator.IntegrationTests.Core.Models.Entities;
+namespace BuilderGenerator.Tests.Core.Models.Entities;
public class Order : AuditableEntity
{
diff --git a/src/BuilderGenerator.IntegrationTests.Core/Models/Entities/OrderItem.cs b/src/BuilderGenerator.Tests.Core/Models/Entities/OrderItem.cs
similarity index 72%
rename from src/BuilderGenerator.IntegrationTests.Core/Models/Entities/OrderItem.cs
rename to src/BuilderGenerator.Tests.Core/Models/Entities/OrderItem.cs
index 186dd50..cd58519 100644
--- a/src/BuilderGenerator.IntegrationTests.Core/Models/Entities/OrderItem.cs
+++ b/src/BuilderGenerator.Tests.Core/Models/Entities/OrderItem.cs
@@ -1,6 +1,6 @@
using System;
-namespace BuilderGenerator.IntegrationTests.Core.Models.Entities;
+namespace BuilderGenerator.Tests.Core.Models.Entities;
public class OrderItem : AuditableEntity
{
diff --git a/src/BuilderGenerator.IntegrationTests.Core/Models/Entities/README.md b/src/BuilderGenerator.Tests.Core/Models/Entities/README.md
similarity index 100%
rename from src/BuilderGenerator.IntegrationTests.Core/Models/Entities/README.md
rename to src/BuilderGenerator.Tests.Core/Models/Entities/README.md
diff --git a/src/BuilderGenerator.IntegrationTests.Core/Models/Entities/User.cs b/src/BuilderGenerator.Tests.Core/Models/Entities/User.cs
similarity index 83%
rename from src/BuilderGenerator.IntegrationTests.Core/Models/Entities/User.cs
rename to src/BuilderGenerator.Tests.Core/Models/Entities/User.cs
index 0858bfd..bd47022 100644
--- a/src/BuilderGenerator.IntegrationTests.Core/Models/Entities/User.cs
+++ b/src/BuilderGenerator.Tests.Core/Models/Entities/User.cs
@@ -2,7 +2,7 @@
using System.Collections.Generic;
-namespace BuilderGenerator.IntegrationTests.Core.Models.Entities;
+namespace BuilderGenerator.Tests.Core.Models.Entities;
public partial class User : AuditableEntity
{
diff --git a/src/BuilderGenerator.IntegrationTests.Core/Models/Entities/_ReadMe.md b/src/BuilderGenerator.Tests.Core/Models/Entities/_ReadMe.md
similarity index 100%
rename from src/BuilderGenerator.IntegrationTests.Core/Models/Entities/_ReadMe.md
rename to src/BuilderGenerator.Tests.Core/Models/Entities/_ReadMe.md
diff --git a/src/BuilderGenerator.IntegrationTests.Core/Models/Enums/OrderStatus.cs b/src/BuilderGenerator.Tests.Core/Models/Enums/OrderStatus.cs
similarity index 65%
rename from src/BuilderGenerator.IntegrationTests.Core/Models/Enums/OrderStatus.cs
rename to src/BuilderGenerator.Tests.Core/Models/Enums/OrderStatus.cs
index a5c6acb..45acaee 100644
--- a/src/BuilderGenerator.IntegrationTests.Core/Models/Enums/OrderStatus.cs
+++ b/src/BuilderGenerator.Tests.Core/Models/Enums/OrderStatus.cs
@@ -1,4 +1,4 @@
-namespace BuilderGenerator.IntegrationTests.Core.Models.Enums;
+namespace BuilderGenerator.Tests.Core.Models.Enums;
public enum OrderStatus
{
diff --git a/src/BuilderGenerator.IntegrationTests.Core/README.md b/src/BuilderGenerator.Tests.Core/README.md
similarity index 100%
rename from src/BuilderGenerator.IntegrationTests.Core/README.md
rename to src/BuilderGenerator.Tests.Core/README.md
diff --git a/src/BuilderGenerator.IntegrationTests.Net60/BuilderGenerator.IntegrationTests.Net60.csproj b/src/BuilderGenerator.Tests.Integration.Net60/BuilderGenerator.Tests.Integration.Net60.csproj
similarity index 75%
rename from src/BuilderGenerator.IntegrationTests.Net60/BuilderGenerator.IntegrationTests.Net60.csproj
rename to src/BuilderGenerator.Tests.Integration.Net60/BuilderGenerator.Tests.Integration.Net60.csproj
index c8d725f..ce8f1bd 100644
--- a/src/BuilderGenerator.IntegrationTests.Net60/BuilderGenerator.IntegrationTests.Net60.csproj
+++ b/src/BuilderGenerator.Tests.Integration.Net60/BuilderGenerator.Tests.Integration.Net60.csproj
@@ -7,6 +7,8 @@
+
+
@@ -14,8 +16,4 @@
-
-
-
-
\ No newline at end of file
diff --git a/src/BuilderGenerator.Tests.Integration.Net60/Builders/CollectionTypeSampleBuilder.cs b/src/BuilderGenerator.Tests.Integration.Net60/Builders/CollectionTypeSampleBuilder.cs
new file mode 100644
index 0000000..9cac78f
--- /dev/null
+++ b/src/BuilderGenerator.Tests.Integration.Net60/Builders/CollectionTypeSampleBuilder.cs
@@ -0,0 +1,8 @@
+using BuilderGenerator.Tests.Core.Models.Entities;
+
+namespace BuilderGenerator.Tests.Integration.Net60.Builders;
+
+[BuilderFor(typeof(CollectionTypesSample))]
+public partial class CollectionTypeSampleBuilder
+{
+}
diff --git a/src/BuilderGenerator.IntegrationTests.Net60/Builders/OrderBuilder.cs b/src/BuilderGenerator.Tests.Integration.Net60/Builders/OrderBuilder.cs
similarity index 81%
rename from src/BuilderGenerator.IntegrationTests.Net60/Builders/OrderBuilder.cs
rename to src/BuilderGenerator.Tests.Integration.Net60/Builders/OrderBuilder.cs
index 541c574..9b02a39 100644
--- a/src/BuilderGenerator.IntegrationTests.Net60/Builders/OrderBuilder.cs
+++ b/src/BuilderGenerator.Tests.Integration.Net60/Builders/OrderBuilder.cs
@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
-using BuilderGenerator.IntegrationTests.Core.Models.Entities;
+using BuilderGenerator.Tests.Core.Models.Entities;
-namespace BuilderGenerator.IntegrationTests.Net60.Builders;
+namespace BuilderGenerator.Tests.Integration.Net60.Builders;
[BuilderFor(typeof(Order), true)]
public partial class OrderBuilder
diff --git a/src/BuilderGenerator.IntegrationTests.Net60/Builders/OrderItemBuilder.cs b/src/BuilderGenerator.Tests.Integration.Net60/Builders/OrderItemBuilder.cs
similarity index 67%
rename from src/BuilderGenerator.IntegrationTests.Net60/Builders/OrderItemBuilder.cs
rename to src/BuilderGenerator.Tests.Integration.Net60/Builders/OrderItemBuilder.cs
index 8417de8..5e27fba 100644
--- a/src/BuilderGenerator.IntegrationTests.Net60/Builders/OrderItemBuilder.cs
+++ b/src/BuilderGenerator.Tests.Integration.Net60/Builders/OrderItemBuilder.cs
@@ -1,7 +1,7 @@
using System;
-using BuilderGenerator.IntegrationTests.Core.Models.Entities;
+using BuilderGenerator.Tests.Core.Models.Entities;
-namespace BuilderGenerator.IntegrationTests.Net60.Builders;
+namespace BuilderGenerator.Tests.Integration.Net60.Builders;
[BuilderFor(typeof(OrderItem))]
public partial class OrderItemBuilder
diff --git a/src/BuilderGenerator.IntegrationTests.Net60/Builders/README.md b/src/BuilderGenerator.Tests.Integration.Net60/Builders/README.md
similarity index 100%
rename from src/BuilderGenerator.IntegrationTests.Net60/Builders/README.md
rename to src/BuilderGenerator.Tests.Integration.Net60/Builders/README.md
diff --git a/src/BuilderGenerator.IntegrationTests.Net60/Builders/UserBuilder.cs b/src/BuilderGenerator.Tests.Integration.Net60/Builders/UserBuilder.cs
similarity index 85%
rename from src/BuilderGenerator.IntegrationTests.Net60/Builders/UserBuilder.cs
rename to src/BuilderGenerator.Tests.Integration.Net60/Builders/UserBuilder.cs
index a2caba2..1fc7fb0 100644
--- a/src/BuilderGenerator.IntegrationTests.Net60/Builders/UserBuilder.cs
+++ b/src/BuilderGenerator.Tests.Integration.Net60/Builders/UserBuilder.cs
@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
-using BuilderGenerator.IntegrationTests.Core.Models.Entities;
+using BuilderGenerator.Tests.Core.Models.Entities;
-namespace BuilderGenerator.IntegrationTests.Net60.Builders;
+namespace BuilderGenerator.Tests.Integration.Net60.Builders;
[BuilderFor(typeof(User))]
public partial class UserBuilder
diff --git a/src/BuilderGenerator.IntegrationTests.Net60/README.md b/src/BuilderGenerator.Tests.Integration.Net60/README.md
similarity index 100%
rename from src/BuilderGenerator.IntegrationTests.Net60/README.md
rename to src/BuilderGenerator.Tests.Integration.Net60/README.md
diff --git a/src/BuilderGenerator.IntegrationTests.Net60/Tests/BuilderTests.cs b/src/BuilderGenerator.Tests.Integration.Net60/Tests/BuilderTests.cs
similarity index 90%
rename from src/BuilderGenerator.IntegrationTests.Net60/Tests/BuilderTests.cs
rename to src/BuilderGenerator.Tests.Integration.Net60/Tests/BuilderTests.cs
index eee3435..97fb650 100644
--- a/src/BuilderGenerator.IntegrationTests.Net60/Tests/BuilderTests.cs
+++ b/src/BuilderGenerator.Tests.Integration.Net60/Tests/BuilderTests.cs
@@ -1,10 +1,10 @@
using System;
-using BuilderGenerator.IntegrationTests.Core.Models.Entities;
-using BuilderGenerator.IntegrationTests.Net60.Builders;
+using BuilderGenerator.Tests.Core.Models.Entities;
+using BuilderGenerator.Tests.Integration.Net60.Builders;
using NUnit.Framework;
using Shouldly;
-namespace BuilderGenerator.IntegrationTests.Net60.Tests;
+namespace BuilderGenerator.Tests.Integration.Net60.Tests;
[TestFixture]
public class BuilderTests
diff --git a/src/BuilderGenerator.IntegrationTests.Net60/Tests/OrderBuilderTests.cs b/src/BuilderGenerator.Tests.Integration.Net60/Tests/OrderBuilderTests.cs
similarity index 87%
rename from src/BuilderGenerator.IntegrationTests.Net60/Tests/OrderBuilderTests.cs
rename to src/BuilderGenerator.Tests.Integration.Net60/Tests/OrderBuilderTests.cs
index f0c5a6b..1f20493 100644
--- a/src/BuilderGenerator.IntegrationTests.Net60/Tests/OrderBuilderTests.cs
+++ b/src/BuilderGenerator.Tests.Integration.Net60/Tests/OrderBuilderTests.cs
@@ -1,11 +1,11 @@
using System;
-using BuilderGenerator.IntegrationTests.Core.Models.Entities;
-using BuilderGenerator.IntegrationTests.Core.Models.Enums;
-using BuilderGenerator.IntegrationTests.Net60.Builders;
+using BuilderGenerator.Tests.Core.Models.Entities;
+using BuilderGenerator.Tests.Core.Models.Enums;
+using BuilderGenerator.Tests.Integration.Net60.Builders;
using NUnit.Framework;
using Shouldly;
-namespace BuilderGenerator.IntegrationTests.Net60.Tests;
+namespace BuilderGenerator.Tests.Integration.Net60.Tests;
[TestFixture]
public class OrderBuilderTests
diff --git a/src/BuilderGenerator.IntegrationTests.Net60/Tests/UserBuilderTests.cs b/src/BuilderGenerator.Tests.Integration.Net60/Tests/UserBuilderTests.cs
similarity index 90%
rename from src/BuilderGenerator.IntegrationTests.Net60/Tests/UserBuilderTests.cs
rename to src/BuilderGenerator.Tests.Integration.Net60/Tests/UserBuilderTests.cs
index 44f74a0..e2fce5b 100644
--- a/src/BuilderGenerator.IntegrationTests.Net60/Tests/UserBuilderTests.cs
+++ b/src/BuilderGenerator.Tests.Integration.Net60/Tests/UserBuilderTests.cs
@@ -1,10 +1,10 @@
using System;
-using BuilderGenerator.IntegrationTests.Core.Models.Entities;
-using BuilderGenerator.IntegrationTests.Net60.Builders;
+using BuilderGenerator.Tests.Core.Models.Entities;
+using BuilderGenerator.Tests.Integration.Net60.Builders;
using NUnit.Framework;
using Shouldly;
-namespace BuilderGenerator.IntegrationTests.Net60.Tests;
+namespace BuilderGenerator.Tests.Integration.Net60.Tests;
[TestFixture]
public class UserBuilderTests
diff --git a/src/BuilderGenerator.Tests.Unit/BuilderGenerator - Backup.UnitTests.csproj b/src/BuilderGenerator.Tests.Unit/BuilderGenerator - Backup.UnitTests.csproj
new file mode 100644
index 0000000..1ea3ca6
--- /dev/null
+++ b/src/BuilderGenerator.Tests.Unit/BuilderGenerator - Backup.UnitTests.csproj
@@ -0,0 +1,36 @@
+
+
+
+ net6.0
+ enable
+ false
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ResXFileCodeGenerator
+
+
+
+
diff --git a/src/BuilderGenerator.UnitTests/BuilderGenerator.UnitTests.csproj b/src/BuilderGenerator.Tests.Unit/BuilderGenerator.Tests.Unit.csproj
similarity index 78%
rename from src/BuilderGenerator.UnitTests/BuilderGenerator.UnitTests.csproj
rename to src/BuilderGenerator.Tests.Unit/BuilderGenerator.Tests.Unit.csproj
index ec324ce..c7bf7f1 100644
--- a/src/BuilderGenerator.UnitTests/BuilderGenerator.UnitTests.csproj
+++ b/src/BuilderGenerator.Tests.Unit/BuilderGenerator.Tests.Unit.csproj
@@ -15,6 +15,11 @@
+
+
+
+
+
@@ -32,18 +37,7 @@
-
- True
- True
- Resources.resx
-
-
-
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
-
+
\ No newline at end of file
diff --git a/src/BuilderGenerator.UnitTests/BuilderGenerator.UnitTests.csproj.DotSettings b/src/BuilderGenerator.Tests.Unit/BuilderGenerator.Tests.Unit.csproj.DotSettings
similarity index 100%
rename from src/BuilderGenerator.UnitTests/BuilderGenerator.UnitTests.csproj.DotSettings
rename to src/BuilderGenerator.Tests.Unit/BuilderGenerator.Tests.Unit.csproj.DotSettings
diff --git a/src/BuilderGenerator.Tests.Unit/BuilderGenerator.UnitTests.csproj.DotSettings b/src/BuilderGenerator.Tests.Unit/BuilderGenerator.UnitTests.csproj.DotSettings
new file mode 100644
index 0000000..3fc2808
--- /dev/null
+++ b/src/BuilderGenerator.Tests.Unit/BuilderGenerator.UnitTests.csproj.DotSettings
@@ -0,0 +1,2 @@
+
+ True
\ No newline at end of file
diff --git a/src/BuilderGenerator.Tests.Unit/Examples/.editorconfig b/src/BuilderGenerator.Tests.Unit/Examples/.editorconfig
new file mode 100644
index 0000000..ff371f4
--- /dev/null
+++ b/src/BuilderGenerator.Tests.Unit/Examples/.editorconfig
@@ -0,0 +1,16 @@
+root=true
+# To learn more about .editorconfig see https://aka.ms/editorconfigdocs
+# When specifying tool-specific properties, such as ReSharper's extended properties (https://www.jetbrains.com/help/resharper/EditorConfig_Index.html)
+# Use the most generically-named version of the property (i.e. choose "brace_style" over "csharp_brace_style" or "resharper_csharp_brace_style")
+# Hopefully, these settings become supported by Visual Studio, or add-ins liks CodeMaid.
+
+
+# This file is the top-most EditorConfig file
+
+# All Files (Unless overridden elsewhere)
+[*]
+charset=utf-8
+end_of_line=crlf
+indent_size=4
+indent_style=space
+insert_final_newline=false
\ No newline at end of file
diff --git a/src/BuilderGenerator.UnitTests/Examples/InputWithInternals.cs b/src/BuilderGenerator.Tests.Unit/Examples/InputWithInternals.cs
similarity index 100%
rename from src/BuilderGenerator.UnitTests/Examples/InputWithInternals.cs
rename to src/BuilderGenerator.Tests.Unit/Examples/InputWithInternals.cs
diff --git a/src/BuilderGenerator.UnitTests/Examples/InputWithoutInternals.cs b/src/BuilderGenerator.Tests.Unit/Examples/InputWithoutInternals.cs
similarity index 100%
rename from src/BuilderGenerator.UnitTests/Examples/InputWithoutInternals.cs
rename to src/BuilderGenerator.Tests.Unit/Examples/InputWithoutInternals.cs
diff --git a/src/BuilderGenerator.UnitTests/Examples/OutputWithInternals.cs b/src/BuilderGenerator.Tests.Unit/Examples/OutputWithInternals.cs
similarity index 73%
rename from src/BuilderGenerator.UnitTests/Examples/OutputWithInternals.cs
rename to src/BuilderGenerator.Tests.Unit/Examples/OutputWithInternals.cs
index 33df781..d567fbc 100644
--- a/src/BuilderGenerator.UnitTests/Examples/OutputWithInternals.cs
+++ b/src/BuilderGenerator.Tests.Unit/Examples/OutputWithInternals.cs
@@ -1,5 +1,3 @@
-#nullable disable
-
using System.CodeDom.Compiler;
using BuilderGenerator;
@@ -15,24 +13,32 @@ public override BuilderGenerator.UnitTests.Person Build()
{
if (Object?.IsValueCreated != true)
{
- Object = new System.Lazy(() =>
- {
- var result = new BuilderGenerator.UnitTests.Person
- {
- FirstName = FirstName.Value,
- InternalString = InternalString.Value,
- LastName = LastName.Value,
- };
-
- return result;
- });
-
- PostProcess(Object.Value);
+ Object = new System.Lazy(new BuilderGenerator.UnitTests.Person());
}
+ Object.Value.FirstName = FirstName.Value;
+ Object.Value.InternalString = InternalString.Value;
+ Object.Value.LastName = LastName.Value;
+
+ PostProcess(Object.Value);
+
return Object.Value;
}
+ /// Sets the object to be returned by this instance.
+ /// The object to be returned.
+ /// A reference to this builder instance.
+ public override Builder WithObject(BuilderGenerator.UnitTests.Person value)
+ {
+ base.WithObject(value);
+
+ WithFirstName(value.FirstName);
+ WithInternalString(value.InternalString);
+ WithLastName(value.LastName);
+
+ return this;
+ }
+
public PersonBuilderWithInternals WithFirstName(string value)
{
return WithFirstName(() => value);
diff --git a/src/BuilderGenerator.UnitTests/Examples/OutputWithoutInternals.cs b/src/BuilderGenerator.Tests.Unit/Examples/OutputWithoutInternals.cs
similarity index 70%
rename from src/BuilderGenerator.UnitTests/Examples/OutputWithoutInternals.cs
rename to src/BuilderGenerator.Tests.Unit/Examples/OutputWithoutInternals.cs
index afca88c..d1bc141 100644
--- a/src/BuilderGenerator.UnitTests/Examples/OutputWithoutInternals.cs
+++ b/src/BuilderGenerator.Tests.Unit/Examples/OutputWithoutInternals.cs
@@ -1,5 +1,3 @@
-#nullable disable
-
using System.CodeDom.Compiler;
using BuilderGenerator;
@@ -14,23 +12,30 @@ public override BuilderGenerator.UnitTests.Person Build()
{
if (Object?.IsValueCreated != true)
{
- Object = new System.Lazy(() =>
- {
- var result = new BuilderGenerator.UnitTests.Person
- {
- FirstName = FirstName.Value,
- LastName = LastName.Value,
- };
+ Object = new System.Lazy(new BuilderGenerator.UnitTests.Person());
+ }
- return result;
- });
+ Object.Value.FirstName = FirstName.Value;
+ Object.Value.LastName = LastName.Value;
- PostProcess(Object.Value);
- }
+ PostProcess(Object.Value);
return Object.Value;
}
+ /// Sets the object to be returned by this instance.
+ /// The object to be returned.
+ /// A reference to this builder instance.
+ public override Builder WithObject(BuilderGenerator.UnitTests.Person value)
+ {
+ base.WithObject(value);
+
+ WithFirstName(value.FirstName);
+ WithLastName(value.LastName);
+
+ return this;
+ }
+
public PersonBuilderWithoutInternals WithFirstName(string value)
{
return WithFirstName(() => value);
diff --git a/src/BuilderGenerator.UnitTests/Given_a_BuilderGenerator.cs b/src/BuilderGenerator.Tests.Unit/Given_a_BuilderGenerator.cs
similarity index 90%
rename from src/BuilderGenerator.UnitTests/Given_a_BuilderGenerator.cs
rename to src/BuilderGenerator.Tests.Unit/Given_a_BuilderGenerator.cs
index 3ba4ffd..3ddc72b 100644
--- a/src/BuilderGenerator.UnitTests/Given_a_BuilderGenerator.cs
+++ b/src/BuilderGenerator.Tests.Unit/Given_a_BuilderGenerator.cs
@@ -7,14 +7,14 @@
// ReSharper disable InconsistentNaming
-namespace BuilderGenerator.UnitTests;
+namespace BuilderGenerator.Tests.Unit;
public abstract class Given_a_BuilderGenerator
{
public static string GetResourceAsString(Assembly assembly, string resourceName)
{
var manifestResourceNames = assembly.GetManifestResourceNames();
- resourceName = manifestResourceNames.Single(x => x.Equals($"BuilderGenerator.UnitTests.Examples.{resourceName}", StringComparison.OrdinalIgnoreCase));
+ resourceName = manifestResourceNames.Single(x => x.Equals($"BuilderGenerator.Tests.Unit.Examples.{resourceName}", StringComparison.OrdinalIgnoreCase));
using (var stream = assembly.GetManifestResourceStream(resourceName))
{
diff --git a/src/BuilderGenerator.UnitTests/When_generating_a_Builder_with_internals.cs b/src/BuilderGenerator.Tests.Unit/When_generating_a_Builder_with_internals.cs
similarity index 98%
rename from src/BuilderGenerator.UnitTests/When_generating_a_Builder_with_internals.cs
rename to src/BuilderGenerator.Tests.Unit/When_generating_a_Builder_with_internals.cs
index 311ccd6..ff57c81 100644
--- a/src/BuilderGenerator.UnitTests/When_generating_a_Builder_with_internals.cs
+++ b/src/BuilderGenerator.Tests.Unit/When_generating_a_Builder_with_internals.cs
@@ -7,7 +7,7 @@
// ReSharper disable InconsistentNaming
-namespace BuilderGenerator.UnitTests;
+namespace BuilderGenerator.Tests.Unit;
[TestFixture]
public class When_generating_a_Builder_with_internals : Given_a_BuilderGenerator
diff --git a/src/BuilderGenerator.UnitTests/When_generating_a_Builder_without_internals.cs b/src/BuilderGenerator.Tests.Unit/When_generating_a_Builder_without_internals.cs
similarity index 98%
rename from src/BuilderGenerator.UnitTests/When_generating_a_Builder_without_internals.cs
rename to src/BuilderGenerator.Tests.Unit/When_generating_a_Builder_without_internals.cs
index eda3b42..c63e3cf 100644
--- a/src/BuilderGenerator.UnitTests/When_generating_a_Builder_without_internals.cs
+++ b/src/BuilderGenerator.Tests.Unit/When_generating_a_Builder_without_internals.cs
@@ -7,7 +7,7 @@
// ReSharper disable InconsistentNaming
-namespace BuilderGenerator.UnitTests;
+namespace BuilderGenerator.Tests.Unit;
[TestFixture]
public class When_generating_a_Builder_without_internals : Given_a_BuilderGenerator
diff --git a/src/BuilderGenerator.UnitTests/Properties/Resources.Designer.cs b/src/BuilderGenerator.UnitTests/Properties/Resources.Designer.cs
deleted file mode 100644
index 9e017bf..0000000
--- a/src/BuilderGenerator.UnitTests/Properties/Resources.Designer.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace BuilderGenerator.UnitTests.Properties {
- using System;
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources() {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BuilderGenerator.UnitTests.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
- }
-}
diff --git a/src/BuilderGenerator.UnitTests/Properties/Resources.resx b/src/BuilderGenerator.UnitTests/Properties/Resources.resx
deleted file mode 100644
index 1af7de1..0000000
--- a/src/BuilderGenerator.UnitTests/Properties/Resources.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/src/BuilderGenerator.sln b/src/BuilderGenerator.sln
index 96848bf..192c496 100644
--- a/src/BuilderGenerator.sln
+++ b/src/BuilderGenerator.sln
@@ -36,11 +36,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "devops", "devops", "{6842FF
..\.github\workflows\release.yml = ..\.github\workflows\release.yml
EndProjectSection
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BuilderGenerator.UnitTests", "BuilderGenerator.UnitTests\BuilderGenerator.UnitTests.csproj", "{9E5D2BCF-B25E-4A2F-9042-E83BADF268C4}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BuilderGenerator.Tests.Unit", "BuilderGenerator.Tests.Unit\BuilderGenerator.Tests.Unit.csproj", "{9E5D2BCF-B25E-4A2F-9042-E83BADF268C4}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BuilderGenerator.IntegrationTests.Core", "BuilderGenerator.IntegrationTests.Core\BuilderGenerator.IntegrationTests.Core.csproj", "{4C0FCA0D-2B74-4125-B106-A32191D39EDB}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BuilderGenerator.Tests.Integration.Net60", "BuilderGenerator.Tests.Integration.Net60\BuilderGenerator.Tests.Integration.Net60.csproj", "{5C41CBD1-A607-42B2-8DDE-50061662B5A8}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BuilderGenerator.IntegrationTests.Net60", "BuilderGenerator.IntegrationTests.Net60\BuilderGenerator.IntegrationTests.Net60.csproj", "{5C41CBD1-A607-42B2-8DDE-50061662B5A8}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BuilderGenerator.Tests.Core", "BuilderGenerator.Tests.Core\BuilderGenerator.Tests.Core.csproj", "{4F3A684D-C598-45E1-A324-7027818E382A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -56,14 +56,14 @@ Global
{9E5D2BCF-B25E-4A2F-9042-E83BADF268C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9E5D2BCF-B25E-4A2F-9042-E83BADF268C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9E5D2BCF-B25E-4A2F-9042-E83BADF268C4}.Release|Any CPU.Build.0 = Release|Any CPU
- {4C0FCA0D-2B74-4125-B106-A32191D39EDB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4C0FCA0D-2B74-4125-B106-A32191D39EDB}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {4C0FCA0D-2B74-4125-B106-A32191D39EDB}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {4C0FCA0D-2B74-4125-B106-A32191D39EDB}.Release|Any CPU.Build.0 = Release|Any CPU
{5C41CBD1-A607-42B2-8DDE-50061662B5A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5C41CBD1-A607-42B2-8DDE-50061662B5A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5C41CBD1-A607-42B2-8DDE-50061662B5A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5C41CBD1-A607-42B2-8DDE-50061662B5A8}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4F3A684D-C598-45E1-A324-7027818E382A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4F3A684D-C598-45E1-A324-7027818E382A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4F3A684D-C598-45E1-A324-7027818E382A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4F3A684D-C598-45E1-A324-7027818E382A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/src/BuilderGenerator/BuilderGenerator.cs b/src/BuilderGenerator/BuilderGenerator.cs
index 816d943..dd2b560 100644
--- a/src/BuilderGenerator/BuilderGenerator.cs
+++ b/src/BuilderGenerator/BuilderGenerator.cs
@@ -21,30 +21,34 @@ internal class BuilderGenerator : IIncrementalGenerator
private static readonly string BuilderBaseClass;
private static readonly string BuilderClass;
private static readonly string BuilderForAttribute;
+ private static readonly string BuilderProperty;
private static readonly string BuildMethod;
private static readonly string BuildMethodSetter;
#pragma warning disable RS1035
private static readonly string NewLine = Environment.NewLine; // TODO: Derive this value from the project itself
#pragma warning restore RS1035
- private static readonly string Property;
- private static readonly string WithMethod;
+ private static readonly string WithMethods;
+ private static readonly string WithObjectMethod;
+ private static readonly string WithObjectMethodSetter;
static BuilderGenerator()
{
var assembly = typeof(BuilderGenerator).Assembly;
- BuilderBaseClass = GetResourceAsString(assembly, nameof(BuilderBaseClass));
- BuilderClass = GetResourceAsString(assembly, nameof(BuilderClass));
- BuilderForAttribute = GetResourceAsString(assembly, nameof(BuilderForAttribute));
- BuildMethodSetter = GetResourceAsString(assembly, nameof(BuildMethodSetter));
- BuildMethod = GetResourceAsString(assembly, nameof(BuildMethod));
- Property = GetResourceAsString(assembly, nameof(Property));
- WithMethod = GetResourceAsString(assembly, nameof(WithMethod));
+ BuilderBaseClass = GetResourceAsString(assembly, $"{nameof(BuilderBaseClass)}.cs");
+ BuilderClass = GetResourceAsString(assembly, $"{nameof(BuilderClass)}.cs");
+ BuilderForAttribute = GetResourceAsString(assembly, $"{nameof(BuilderForAttribute)}.cs");
+ BuilderProperty = GetResourceAsString(assembly, $"{nameof(BuilderProperty)}.cs");
+ BuildMethodSetter = GetResourceAsString(assembly, $"{nameof(BuildMethodSetter)}.cs");
+ BuildMethod = GetResourceAsString(assembly, $"{nameof(BuildMethod)}.cs");
+ WithMethods = GetResourceAsString(assembly, $"{nameof(WithMethods)}.cs");
+ WithObjectMethod = GetResourceAsString(assembly, $"{nameof(WithObjectMethod)}.cs");
+ WithObjectMethodSetter = GetResourceAsString(assembly, $"{nameof(WithObjectMethodSetter)}.cs");
}
public static string GetResourceAsString(Assembly assembly, string resourceName)
{
- resourceName = assembly.GetManifestResourceNames().Single(x => x.Equals($"BuilderGenerator.Templates.{resourceName}.txt", StringComparison.OrdinalIgnoreCase));
+ resourceName = assembly.GetManifestResourceNames().Single(x => x.Equals($"BuilderGenerator.Templates.{resourceName}", StringComparison.OrdinalIgnoreCase));
using (var stream = assembly.GetManifestResourceStream(resourceName))
{
@@ -133,26 +137,46 @@ private static string GenerateProperties(TemplateParser templateParser, IEnumera
templateParser.SetTag("PropertyName", x.Name);
templateParser.SetTag("PropertyType", x.Type);
- return templateParser.ParseString(Property);
+ return templateParser.ParseString(BuilderProperty);
}));
return result;
}
- private static string GenerateWithMethods(TemplateParser templateParser, IEnumerable properties)
+ private static string GenerateWithMethods(TemplateParser templateParser, ICollection properties)
{
- var result = string.Join(
- NewLine,
- properties.Select(
- x =>
- {
- templateParser.SetTag("PropertyName", x.Name);
- templateParser.SetTag("PropertyType", x.Type);
-
- return templateParser.ParseString(WithMethod);
- }));
-
- return result;
+ var builder = new StringBuilder();
+
+ // Build the WithObject method first
+ templateParser.SetTag(
+ "WithObjectMethodSetters",
+ string.Join(
+ NewLine,
+ properties.Select(
+ x =>
+ {
+ templateParser.SetTag("PropertyName", x.Name);
+ templateParser.SetTag("PropertyType", x.Type);
+
+ return templateParser.ParseString(WithObjectMethodSetter);
+ })));
+
+ builder.AppendLine(templateParser.ParseString(WithObjectMethod));
+
+ // Add in the individual With methods
+ builder.Append(
+ string.Join(
+ NewLine,
+ properties.Select(
+ x =>
+ {
+ templateParser.SetTag("PropertyName", x.Name);
+ templateParser.SetTag("PropertyType", x.Type);
+
+ return templateParser.ParseString(WithMethods);
+ })));
+
+ return builder.ToString();
}
private static IEnumerable GetPropertySymbols(INamedTypeSymbol namedTypeSymbol, bool includeInternals)
diff --git a/src/BuilderGenerator/BuilderGenerator.csproj b/src/BuilderGenerator/BuilderGenerator.csproj
index 403bfd5..828e044 100644
--- a/src/BuilderGenerator/BuilderGenerator.csproj
+++ b/src/BuilderGenerator/BuilderGenerator.csproj
@@ -103,6 +103,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
all
@@ -113,6 +129,13 @@
+
+
+
+
+
+
+
@@ -127,7 +150,7 @@
- <_Parameter1>BuilderGenerator.UnitTests
+ <_Parameter1>BuilderGenerator.Tests.Unit
diff --git a/src/BuilderGenerator/Templates/.editorconfig b/src/BuilderGenerator/Templates/.editorconfig
new file mode 100644
index 0000000..ff371f4
--- /dev/null
+++ b/src/BuilderGenerator/Templates/.editorconfig
@@ -0,0 +1,16 @@
+root=true
+# To learn more about .editorconfig see https://aka.ms/editorconfigdocs
+# When specifying tool-specific properties, such as ReSharper's extended properties (https://www.jetbrains.com/help/resharper/EditorConfig_Index.html)
+# Use the most generically-named version of the property (i.e. choose "brace_style" over "csharp_brace_style" or "resharper_csharp_brace_style")
+# Hopefully, these settings become supported by Visual Studio, or add-ins liks CodeMaid.
+
+
+# This file is the top-most EditorConfig file
+
+# All Files (Unless overridden elsewhere)
+[*]
+charset=utf-8
+end_of_line=crlf
+indent_size=4
+indent_style=space
+insert_final_newline=false
\ No newline at end of file
diff --git a/src/BuilderGenerator/Templates/BuildMethod.txt b/src/BuilderGenerator/Templates/BuildMethod.cs
similarity index 51%
rename from src/BuilderGenerator/Templates/BuildMethod.txt
rename to src/BuilderGenerator/Templates/BuildMethod.cs
index e7edd4d..096ef51 100644
--- a/src/BuilderGenerator/Templates/BuildMethod.txt
+++ b/src/BuilderGenerator/Templates/BuildMethod.cs
@@ -3,18 +3,12 @@
{
if (Object?.IsValueCreated != true)
{
- Object = new System.Lazy<{{TargetClassFullName}}>(() =>
- {
- var result = new {{TargetClassFullName}}
- {
-{{Setters}}
- };
+ Object = new System.Lazy<{{TargetClassFullName}}>(new {{TargetClassFullName}}());
+ }
- return result;
- });
+{{Setters}}
- PostProcess(Object.Value);
- }
+ PostProcess(Object.Value);
return Object.Value;
- }
\ No newline at end of file
+ }
diff --git a/src/BuilderGenerator/Templates/BuildMethodSetter.cs b/src/BuilderGenerator/Templates/BuildMethodSetter.cs
new file mode 100644
index 0000000..ec6c7b0
--- /dev/null
+++ b/src/BuilderGenerator/Templates/BuildMethodSetter.cs
@@ -0,0 +1 @@
+ Object.Value.{{PropertyName}} = {{PropertyName}}.Value;
\ No newline at end of file
diff --git a/src/BuilderGenerator/Templates/BuildMethodSetter.txt b/src/BuilderGenerator/Templates/BuildMethodSetter.txt
deleted file mode 100644
index 71ab8ad..0000000
--- a/src/BuilderGenerator/Templates/BuildMethodSetter.txt
+++ /dev/null
@@ -1 +0,0 @@
- {{PropertyName}} = {{PropertyName}}.Value,
\ No newline at end of file
diff --git a/src/BuilderGenerator/Templates/BuilderBaseClass.txt b/src/BuilderGenerator/Templates/BuilderBaseClass.cs
similarity index 95%
rename from src/BuilderGenerator/Templates/BuilderBaseClass.txt
rename to src/BuilderGenerator/Templates/BuilderBaseClass.cs
index f261ae9..0a4b3b7 100644
--- a/src/BuilderGenerator/Templates/BuilderBaseClass.txt
+++ b/src/BuilderGenerator/Templates/BuilderBaseClass.cs
@@ -16,18 +16,18 @@ public abstract class Builder where T : class
/// The constructed object.
public abstract T Build();
- protected virtual void PostProcess(T value)
- {
- }
-
/// Sets the object to be returned by this instance.
/// The object to be returned.
/// A reference to this builder instance.
- public Builder WithObject(T value)
+ public virtual Builder WithObject(T value)
{
Object = new System.Lazy(() => value);
return this;
}
+
+ protected virtual void PostProcess(T value)
+ {
+ }
}
}
diff --git a/src/BuilderGenerator/Templates/BuilderClass.txt b/src/BuilderGenerator/Templates/BuilderClass.cs
similarity index 100%
rename from src/BuilderGenerator/Templates/BuilderClass.txt
rename to src/BuilderGenerator/Templates/BuilderClass.cs
diff --git a/src/BuilderGenerator/Templates/BuilderForAttribute.txt b/src/BuilderGenerator/Templates/BuilderForAttribute.cs
similarity index 100%
rename from src/BuilderGenerator/Templates/BuilderForAttribute.txt
rename to src/BuilderGenerator/Templates/BuilderForAttribute.cs
diff --git a/src/BuilderGenerator/Templates/Property.txt b/src/BuilderGenerator/Templates/BuilderProperty.cs
similarity index 100%
rename from src/BuilderGenerator/Templates/Property.txt
rename to src/BuilderGenerator/Templates/BuilderProperty.cs
diff --git a/src/BuilderGenerator/Templates/WithMethod.txt b/src/BuilderGenerator/Templates/WithMethods.cs
similarity index 100%
rename from src/BuilderGenerator/Templates/WithMethod.txt
rename to src/BuilderGenerator/Templates/WithMethods.cs
diff --git a/src/BuilderGenerator/Templates/WithObjectMethod.cs b/src/BuilderGenerator/Templates/WithObjectMethod.cs
new file mode 100644
index 0000000..e58a6c1
--- /dev/null
+++ b/src/BuilderGenerator/Templates/WithObjectMethod.cs
@@ -0,0 +1,11 @@
+ /// Sets the object to be returned by this instance.
+ /// The object to be returned.
+ /// A reference to this builder instance.
+ public override Builder<{{TargetClassFullName}}> WithObject({{TargetClassFullName}} value)
+ {
+ base.WithObject(value);
+
+{{WithObjectMethodSetters}}
+
+ return this;
+ }
\ No newline at end of file
diff --git a/src/BuilderGenerator/Templates/WithObjectMethodSetter.cs b/src/BuilderGenerator/Templates/WithObjectMethodSetter.cs
new file mode 100644
index 0000000..76af117
--- /dev/null
+++ b/src/BuilderGenerator/Templates/WithObjectMethodSetter.cs
@@ -0,0 +1 @@
+ With{{PropertyName}}(value.{{PropertyName}});
\ No newline at end of file