diff --git a/src/Riok.Mapperly/Descriptors/Constructors/InstanceConstructor.cs b/src/Riok.Mapperly/Descriptors/Constructors/InstanceConstructor.cs index 121c28de82..1d5f3a5ded 100644 --- a/src/Riok.Mapperly/Descriptors/Constructors/InstanceConstructor.cs +++ b/src/Riok.Mapperly/Descriptors/Constructors/InstanceConstructor.cs @@ -1,7 +1,6 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; using Riok.Mapperly.Descriptors.Mappings; -using Riok.Mapperly.Emit.Syntax; namespace Riok.Mapperly.Descriptors.Constructors; @@ -13,5 +12,5 @@ public ExpressionSyntax CreateInstance( TypeMappingBuildContext ctx, IEnumerable args, InitializerExpressionSyntax? initializer = null - ) => SyntaxFactoryHelper.CreateInstance(type, args).WithInitializer(initializer); + ) => ctx.SyntaxFactory.CreateInstance(type, args).WithInitializer(initializer); } diff --git a/src/Riok.Mapperly/Descriptors/Enumerables/EnsureCapacity/EnsureCapacityInfo.cs b/src/Riok.Mapperly/Descriptors/Enumerables/EnsureCapacity/EnsureCapacityInfo.cs index dc2701a064..b757f4f175 100644 --- a/src/Riok.Mapperly/Descriptors/Enumerables/EnsureCapacity/EnsureCapacityInfo.cs +++ b/src/Riok.Mapperly/Descriptors/Enumerables/EnsureCapacity/EnsureCapacityInfo.cs @@ -24,6 +24,6 @@ protected static ExpressionStatementSyntax EnsureCapacityStatement( sum = Add(sourceCount, targetCount); } - return syntaxFactory.ExpressionStatement(Invocation(MemberAccess(target, EnsureCapacityName), sum)); + return syntaxFactory.ExpressionStatement(syntaxFactory.Invocation(MemberAccess(target, EnsureCapacityName), sum)); } } diff --git a/src/Riok.Mapperly/Descriptors/Enumerables/EnsureCapacity/EnsureCapacityNonEnumerated.cs b/src/Riok.Mapperly/Descriptors/Enumerables/EnsureCapacity/EnsureCapacityNonEnumerated.cs index af99fdb716..4a0bc32982 100644 --- a/src/Riok.Mapperly/Descriptors/Enumerables/EnsureCapacity/EnsureCapacityNonEnumerated.cs +++ b/src/Riok.Mapperly/Descriptors/Enumerables/EnsureCapacity/EnsureCapacityNonEnumerated.cs @@ -31,7 +31,7 @@ public override StatementSyntax Build(TypeMappingBuildContext ctx, ExpressionSyn var enumerableArgument = Argument(ctx.Source); var outVarArgument = OutVarArgument(sourceCountName); - var getNonEnumeratedInvocation = StaticInvocation(getNonEnumeratedMethod, enumerableArgument, outVarArgument); + var getNonEnumeratedInvocation = ctx.SyntaxFactory.StaticInvocation(getNonEnumeratedMethod, enumerableArgument, outVarArgument); var ensureCapacity = EnsureCapacityStatement( ctx.SyntaxFactory.AddIndentation(), target, diff --git a/src/Riok.Mapperly/Descriptors/Mappings/DerivedExistingTargetTypeSwitchMapping.cs b/src/Riok.Mapperly/Descriptors/Mappings/DerivedExistingTargetTypeSwitchMapping.cs index 3e36fd1eb3..5df5bd42b4 100644 --- a/src/Riok.Mapperly/Descriptors/Mappings/DerivedExistingTargetTypeSwitchMapping.cs +++ b/src/Riok.Mapperly/Descriptors/Mappings/DerivedExistingTargetTypeSwitchMapping.cs @@ -66,8 +66,8 @@ private SwitchSectionSyntax BuildDefaultSwitchSection(TypeMappingBuildContext ct var defaultCaseLabel = DefaultSwitchLabel().AddLeadingLineFeed(sectionCtx.Indentation); // throw new ArgumentException(msg, nameof(ctx.Source)), - var sourceTypeExpr = Invocation(MemberAccess(ctx.Source, GetTypeMethodName)); - var targetTypeExpr = Invocation(MemberAccess(target, GetTypeMethodName)); + var sourceTypeExpr = ctx.SyntaxFactory.Invocation(MemberAccess(ctx.Source, GetTypeMethodName)); + var targetTypeExpr = ctx.SyntaxFactory.Invocation(MemberAccess(target, GetTypeMethodName)); var statementContext = sectionCtx.AddIndentation(); var throwExpression = ThrowArgumentExpression( InterpolatedString($"Cannot map {sourceTypeExpr} to {targetTypeExpr} as there is no known derived type mapping"), diff --git a/src/Riok.Mapperly/Descriptors/Mappings/DerivedTypeSwitchMapping.cs b/src/Riok.Mapperly/Descriptors/Mappings/DerivedTypeSwitchMapping.cs index 0f8a56a34b..abbb46f0fb 100644 --- a/src/Riok.Mapperly/Descriptors/Mappings/DerivedTypeSwitchMapping.cs +++ b/src/Riok.Mapperly/Descriptors/Mappings/DerivedTypeSwitchMapping.cs @@ -18,7 +18,7 @@ public class DerivedTypeSwitchMapping(ITypeSymbol sourceType, ITypeSymbol target public override ExpressionSyntax Build(TypeMappingBuildContext ctx) { // _ => throw new ArgumentException(msg, nameof(ctx.Source)), - var sourceTypeExpr = Invocation(MemberAccess(ctx.Source, GetTypeMethodName)); + var sourceTypeExpr = ctx.SyntaxFactory.Invocation(MemberAccess(ctx.Source, GetTypeMethodName)); var fallbackArm = SwitchArm( DiscardPattern(), ThrowArgumentExpression( diff --git a/src/Riok.Mapperly/Descriptors/Mappings/Enums/EnumFromStringParseMapping.cs b/src/Riok.Mapperly/Descriptors/Mappings/Enums/EnumFromStringParseMapping.cs index 6064060ecc..b9a466cc4a 100644 --- a/src/Riok.Mapperly/Descriptors/Mappings/Enums/EnumFromStringParseMapping.cs +++ b/src/Riok.Mapperly/Descriptors/Mappings/Enums/EnumFromStringParseMapping.cs @@ -22,7 +22,7 @@ public override ExpressionSyntax Build(TypeMappingBuildContext ctx) // System.Enum.Parse(source, ignoreCase) if (genericParseMethodSupported) { - return GenericInvocation( + return ctx.SyntaxFactory.GenericInvocation( EnumClassName, ParseMethodName, new[] { FullyQualifiedIdentifier(TargetType) }, @@ -32,7 +32,7 @@ public override ExpressionSyntax Build(TypeMappingBuildContext ctx) } // (TargetType)System.Enum.Parse(typeof(TargetType), source, ignoreCase) - var enumParseInvocation = Invocation( + var enumParseInvocation = ctx.SyntaxFactory.Invocation( MemberAccess(EnumClassName, ParseMethodName), TypeOfExpression(FullyQualifiedIdentifier(TargetType)), ctx.Source, diff --git a/src/Riok.Mapperly/Descriptors/Mappings/Enums/EnumFromStringSwitchMapping.cs b/src/Riok.Mapperly/Descriptors/Mappings/Enums/EnumFromStringSwitchMapping.cs index 087f400d0c..2fba1dfd12 100644 --- a/src/Riok.Mapperly/Descriptors/Mappings/Enums/EnumFromStringSwitchMapping.cs +++ b/src/Riok.Mapperly/Descriptors/Mappings/Enums/EnumFromStringSwitchMapping.cs @@ -52,7 +52,7 @@ private SwitchExpressionArmSyntax BuildArmIgnoreCase(string ignoreCaseSwitchDesi // when s.Equals(nameof(source.Value1), StringComparison.OrdinalIgnoreCase) var whenClause = SwitchWhen( - Invocation( + InvocationWithoutIndention( MemberAccess(ignoreCaseSwitchDesignatedVariableName, StringEqualsMethodName), NameOf(typeMemberAccess), IdentifierName(StringComparisonFullName) diff --git a/src/Riok.Mapperly/Descriptors/Mappings/Enums/EnumToStringMapping.cs b/src/Riok.Mapperly/Descriptors/Mappings/Enums/EnumToStringMapping.cs index d069e39831..7cbe156048 100644 --- a/src/Riok.Mapperly/Descriptors/Mappings/Enums/EnumToStringMapping.cs +++ b/src/Riok.Mapperly/Descriptors/Mappings/Enums/EnumToStringMapping.cs @@ -19,7 +19,7 @@ public class EnumToStringMapping(ITypeSymbol sourceType, ITypeSymbol targetType, public override IEnumerable BuildBody(TypeMappingBuildContext ctx) { // fallback switch arm: _ => source.ToString() - var fallbackArm = SwitchArm(DiscardPattern(), Invocation(MemberAccess(ctx.Source, ToStringMethodName))); + var fallbackArm = SwitchArm(DiscardPattern(), ctx.SyntaxFactory.Invocation(MemberAccess(ctx.Source, ToStringMethodName))); // switch for each name to the enum value // eg: Enum1.Value1 => "Value1" diff --git a/src/Riok.Mapperly/Descriptors/Mappings/ExistingTarget/ForEachAddEnumerableExistingTargetMapping.cs b/src/Riok.Mapperly/Descriptors/Mappings/ExistingTarget/ForEachAddEnumerableExistingTargetMapping.cs index af5aaffb63..2abae3a1f0 100644 --- a/src/Riok.Mapperly/Descriptors/Mappings/ExistingTarget/ForEachAddEnumerableExistingTargetMapping.cs +++ b/src/Riok.Mapperly/Descriptors/Mappings/ExistingTarget/ForEachAddEnumerableExistingTargetMapping.cs @@ -38,7 +38,7 @@ public override IEnumerable Build(TypeMappingBuildContext ctx, var (loopItemCtx, loopItemVariableName) = ctx.WithNewSource(LoopItemVariableName); var convertedSourceItemExpression = elementMapping.Build(loopItemCtx); var addMethod = MemberAccess(target, insertMethodName); - var body = Invocation(addMethod, convertedSourceItemExpression); + var body = ctx.SyntaxFactory.Invocation(addMethod, convertedSourceItemExpression); yield return ctx.SyntaxFactory.ForEach(loopItemVariableName, ctx.Source, body); } } diff --git a/src/Riok.Mapperly/Descriptors/Mappings/LinqConstructorMapping.cs b/src/Riok.Mapperly/Descriptors/Mappings/LinqConstructorMapping.cs index 2cf55b7de0..ca8b0687df 100644 --- a/src/Riok.Mapperly/Descriptors/Mappings/LinqConstructorMapping.cs +++ b/src/Riok.Mapperly/Descriptors/Mappings/LinqConstructorMapping.cs @@ -24,13 +24,13 @@ public override ExpressionSyntax Build(TypeMappingBuildContext ctx) var (lambdaCtx, lambdaSourceName) = ctx.WithNewScopedSource(); var sourceMapExpression = elementMapping.Build(lambdaCtx); var convertLambda = Lambda(lambdaSourceName, sourceMapExpression); - mappedSource = Invocation(selectMethod, ctx.Source, convertLambda); + mappedSource = ctx.SyntaxFactory.Invocation(selectMethod, ctx.Source, convertLambda); } else { mappedSource = elementMapping.Build(ctx); } - return CreateInstance(TargetType, mappedSource); + return ctx.SyntaxFactory.CreateInstance(TargetType, mappedSource); } } diff --git a/src/Riok.Mapperly/Descriptors/Mappings/LinqDictionaryMapping.cs b/src/Riok.Mapperly/Descriptors/Mappings/LinqDictionaryMapping.cs index 1a863ee359..09b5ce368b 100644 --- a/src/Riok.Mapperly/Descriptors/Mappings/LinqDictionaryMapping.cs +++ b/src/Riok.Mapperly/Descriptors/Mappings/LinqDictionaryMapping.cs @@ -23,7 +23,7 @@ public override ExpressionSyntax Build(TypeMappingBuildContext ctx) // if key and value types do not change then use a simple call // ie: source.ToImmutableDictionary(); if (keyMapping.IsSynthetic && valueMapping.IsSynthetic) - return Invocation(collectMethod, ctx.Source); + return ctx.SyntaxFactory.Invocation(collectMethod, ctx.Source); // create expressions mapping the key and value and then create the final expression // ie: source.ToImmutableDictionary(x => x.Key, x => (int)x.Value); @@ -35,6 +35,6 @@ public override ExpressionSyntax Build(TypeMappingBuildContext ctx) var valueMapExpression = valueMapping.Build(valueLambdaCtx); var valueExpression = Lambda(valueLambdaParamName, valueMapExpression); - return Invocation(collectMethod, ctx.Source, keyExpression, valueExpression); + return ctx.SyntaxFactory.Invocation(collectMethod, ctx.Source, keyExpression, valueExpression); } } diff --git a/src/Riok.Mapperly/Descriptors/Mappings/LinqEnumerableMapping.cs b/src/Riok.Mapperly/Descriptors/Mappings/LinqEnumerableMapping.cs index 739310c2e5..7d8ccf840f 100644 --- a/src/Riok.Mapperly/Descriptors/Mappings/LinqEnumerableMapping.cs +++ b/src/Riok.Mapperly/Descriptors/Mappings/LinqEnumerableMapping.cs @@ -25,13 +25,13 @@ public override ExpressionSyntax Build(TypeMappingBuildContext ctx) var (lambdaCtx, lambdaSourceName) = ctx.WithNewScopedSource(); var sourceMapExpression = elementMapping.Build(lambdaCtx); var convertLambda = Lambda(lambdaSourceName, sourceMapExpression); - mappedSource = Invocation(selectMethod, ctx.Source, convertLambda); + mappedSource = ctx.SyntaxFactory.Invocation(selectMethod, ctx.Source, convertLambda); } else { mappedSource = elementMapping.Build(ctx); } - return collectMethod == null ? mappedSource : Invocation(collectMethod, mappedSource); + return collectMethod == null ? mappedSource : ctx.SyntaxFactory.Invocation(collectMethod, mappedSource); } } diff --git a/src/Riok.Mapperly/Descriptors/Mappings/MemberMappings/MemberNullDelegateAssignmentMapping.cs b/src/Riok.Mapperly/Descriptors/Mappings/MemberMappings/MemberNullDelegateAssignmentMapping.cs index 3dcfc42506..cd6aa956a1 100644 --- a/src/Riok.Mapperly/Descriptors/Mappings/MemberMappings/MemberNullDelegateAssignmentMapping.cs +++ b/src/Riok.Mapperly/Descriptors/Mappings/MemberMappings/MemberNullDelegateAssignmentMapping.cs @@ -74,7 +74,7 @@ public override bool Equals(object? obj) nullConditional: false, skipTrailingNonNullable: true ); - return new[] { ctx.SyntaxFactory.ExpressionStatement(ThrowArgumentNullException(nameofSourceAccess)) }; + return [ctx.SyntaxFactory.ExpressionStatement(ThrowArgumentNullException(nameofSourceAccess))]; } // target.A = null; diff --git a/src/Riok.Mapperly/Descriptors/Mappings/MemberMappings/SourceValue/MethodProvidedSourceValue.cs b/src/Riok.Mapperly/Descriptors/Mappings/MemberMappings/SourceValue/MethodProvidedSourceValue.cs index 56290e33fa..f42774956c 100644 --- a/src/Riok.Mapperly/Descriptors/Mappings/MemberMappings/SourceValue/MethodProvidedSourceValue.cs +++ b/src/Riok.Mapperly/Descriptors/Mappings/MemberMappings/SourceValue/MethodProvidedSourceValue.cs @@ -1,5 +1,4 @@ using Microsoft.CodeAnalysis.CSharp.Syntax; -using static Riok.Mapperly.Emit.Syntax.SyntaxFactoryHelper; namespace Riok.Mapperly.Descriptors.Mappings.MemberMappings.SourceValue; @@ -8,5 +7,5 @@ namespace Riok.Mapperly.Descriptors.Mappings.MemberMappings.SourceValue; /// public class MethodProvidedSourceValue(string methodName) : ISourceValue { - public ExpressionSyntax Build(TypeMappingBuildContext ctx) => Invocation(methodName); + public ExpressionSyntax Build(TypeMappingBuildContext ctx) => ctx.SyntaxFactory.Invocation(methodName); } diff --git a/src/Riok.Mapperly/Descriptors/Mappings/MethodMapping.cs b/src/Riok.Mapperly/Descriptors/Mappings/MethodMapping.cs index ded1a2844e..6403a1aaeb 100644 --- a/src/Riok.Mapperly/Descriptors/Mappings/MethodMapping.cs +++ b/src/Riok.Mapperly/Descriptors/Mappings/MethodMapping.cs @@ -79,7 +79,11 @@ ITypeSymbol targetType public bool IsSynthetic => false; public virtual ExpressionSyntax Build(TypeMappingBuildContext ctx) => - Invocation(MethodName, SourceParameter.WithArgument(ctx.Source), ReferenceHandlerParameter?.WithArgument(ctx.ReferenceHandler)); + ctx.SyntaxFactory.Invocation( + MethodName, + SourceParameter.WithArgument(ctx.Source), + ReferenceHandlerParameter?.WithArgument(ctx.ReferenceHandler) + ); public virtual MethodDeclarationSyntax BuildMethod(SourceEmitterContext ctx) { diff --git a/src/Riok.Mapperly/Descriptors/Mappings/NewValueTupleConstructorMapping.cs b/src/Riok.Mapperly/Descriptors/Mappings/NewValueTupleConstructorMapping.cs index 63e7f2559e..608f5082a2 100644 --- a/src/Riok.Mapperly/Descriptors/Mappings/NewValueTupleConstructorMapping.cs +++ b/src/Riok.Mapperly/Descriptors/Mappings/NewValueTupleConstructorMapping.cs @@ -24,6 +24,6 @@ public override ExpressionSyntax Build(TypeMappingBuildContext ctx) // new ValueTuple(ctorArgs) var ctorArgs = _constructorPropertyMappings.Select(x => x.BuildArgument(ctx, emitFieldName: false)); var typeArguments = TypeArgumentList(((INamedTypeSymbol)TargetType).TypeArguments.Select(NonNullableIdentifier)); - return CreateGenericInstance(ValueTupleName, typeArguments, ctorArgs); + return ctx.SyntaxFactory.CreateGenericInstance(ValueTupleName, typeArguments, ctorArgs); } } diff --git a/src/Riok.Mapperly/Descriptors/Mappings/QueryableProjectionMapping.cs b/src/Riok.Mapperly/Descriptors/Mappings/QueryableProjectionMapping.cs index 919572768f..05f0613302 100644 --- a/src/Riok.Mapperly/Descriptors/Mappings/QueryableProjectionMapping.cs +++ b/src/Riok.Mapperly/Descriptors/Mappings/QueryableProjectionMapping.cs @@ -25,13 +25,11 @@ public override IEnumerable BuildBody(TypeMappingBuildContext c var delegateMappingSyntax = delegateMapping.Build(lambdaCtx); var projectionLambda = Lambda(lambdaSourceName, delegateMappingSyntax); - var select = StaticInvocation(QueryableReceiverName, SelectMethodName, ctx.Source, projectionLambda); + var select = ctx.SyntaxFactory.StaticInvocation(QueryableReceiverName, SelectMethodName, ctx.Source, projectionLambda); var returnStatement = ctx.SyntaxFactory.Return(select); - return new[] - { - returnStatement - .WithLeadingTrivia(returnStatement.GetLeadingTrivia().Insert(0, ElasticCarriageReturnLineFeed).Insert(1, Nullable(false))) - .WithTrailingTrivia(returnStatement.GetTrailingTrivia().Insert(0, ElasticCarriageReturnLineFeed).Insert(1, Nullable(true))) - }; + var leadingTrivia = returnStatement.GetLeadingTrivia().Insert(0, ElasticCarriageReturnLineFeed).Insert(1, Nullable(false)); + var trailingTrivia = returnStatement.GetTrailingTrivia().Insert(0, ElasticCarriageReturnLineFeed).Insert(1, Nullable(true)); + returnStatement = returnStatement.WithLeadingTrivia(leadingTrivia).WithTrailingTrivia(trailingTrivia); + return [returnStatement]; } } diff --git a/src/Riok.Mapperly/Descriptors/Mappings/SourceObjectMethodMapping.cs b/src/Riok.Mapperly/Descriptors/Mappings/SourceObjectMethodMapping.cs index 4e3c542dc2..cf858943d6 100644 --- a/src/Riok.Mapperly/Descriptors/Mappings/SourceObjectMethodMapping.cs +++ b/src/Riok.Mapperly/Descriptors/Mappings/SourceObjectMethodMapping.cs @@ -22,7 +22,10 @@ public class SourceObjectMethodMapping( { public override ExpressionSyntax Build(TypeMappingBuildContext ctx) { - var sourceExpression = Invocation(MemberAccess(ctx.Source, methodName), BuildArguments(ctx).WhereNotNull().ToArray()); + var sourceExpression = ctx.SyntaxFactory.Invocation( + MemberAccess(ctx.Source, methodName), + BuildArguments(ctx).WhereNotNull().ToArray() + ); return delegateMapping == null ? sourceExpression : delegateMapping.Build(ctx.WithSource(sourceExpression)); } diff --git a/src/Riok.Mapperly/Descriptors/Mappings/StaticMethodMapping.cs b/src/Riok.Mapperly/Descriptors/Mappings/StaticMethodMapping.cs index 16e742ee20..abe562856f 100644 --- a/src/Riok.Mapperly/Descriptors/Mappings/StaticMethodMapping.cs +++ b/src/Riok.Mapperly/Descriptors/Mappings/StaticMethodMapping.cs @@ -1,6 +1,5 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; -using static Riok.Mapperly.Emit.Syntax.SyntaxFactoryHelper; namespace Riok.Mapperly.Descriptors.Mappings; @@ -9,5 +8,5 @@ namespace Riok.Mapperly.Descriptors.Mappings; /// public class StaticMethodMapping(IMethodSymbol method) : NewInstanceMapping(method.Parameters.Single().Type, method.ReturnType) { - public override ExpressionSyntax Build(TypeMappingBuildContext ctx) => StaticInvocation(method, ctx.Source); + public override ExpressionSyntax Build(TypeMappingBuildContext ctx) => ctx.SyntaxFactory.StaticInvocation(method, ctx.Source); } diff --git a/src/Riok.Mapperly/Descriptors/Mappings/UserMappings/UserDefinedExistingTargetMethodMapping.cs b/src/Riok.Mapperly/Descriptors/Mappings/UserMappings/UserDefinedExistingTargetMethodMapping.cs index 6a0d97ec43..bde04407bd 100644 --- a/src/Riok.Mapperly/Descriptors/Mappings/UserMappings/UserDefinedExistingTargetMethodMapping.cs +++ b/src/Riok.Mapperly/Descriptors/Mappings/UserMappings/UserDefinedExistingTargetMethodMapping.cs @@ -44,7 +44,7 @@ public override ExpressionSyntax Build(TypeMappingBuildContext ctx) => public IEnumerable Build(TypeMappingBuildContext ctx, ExpressionSyntax target) { return ctx.SyntaxFactory.SingleStatement( - Invocation( + ctx.SyntaxFactory.Invocation( MethodName, SourceParameter.WithArgument(ctx.Source), TargetParameter.WithArgument(target), diff --git a/src/Riok.Mapperly/Descriptors/Mappings/UserMappings/UserDefinedNewInstanceRuntimeTargetTypeMapping.cs b/src/Riok.Mapperly/Descriptors/Mappings/UserMappings/UserDefinedNewInstanceRuntimeTargetTypeMapping.cs index bc53f0bcc5..6d1bd5f9cd 100644 --- a/src/Riok.Mapperly/Descriptors/Mappings/UserMappings/UserDefinedNewInstanceRuntimeTargetTypeMapping.cs +++ b/src/Riok.Mapperly/Descriptors/Mappings/UserMappings/UserDefinedNewInstanceRuntimeTargetTypeMapping.cs @@ -63,7 +63,7 @@ public override IEnumerable BuildBody(TypeMappingBuildContext c var targetTypeExpr = BuildTargetType(); // _ => throw new ArgumentException(msg, nameof(ctx.Source)), - var sourceType = Invocation(MemberAccess(ctx.Source, GetTypeMethodName)); + var sourceType = ctx.SyntaxFactory.Invocation(MemberAccess(ctx.Source, GetTypeMethodName)); var fallbackArm = SwitchArm( DiscardPattern(), ThrowArgumentExpression( @@ -92,7 +92,7 @@ public override IEnumerable BuildBody(TypeMappingBuildContext c protected virtual ExpressionSyntax? BuildSwitchArmWhenClause(ExpressionSyntax runtimeTargetType, RuntimeTargetTypeMapping mapping) { // targetType.IsAssignableFrom(typeof(ADto)) - return Invocation( + return InvocationWithoutIndention( MemberAccess(runtimeTargetType, IsAssignableFromMethodName), TypeOfExpression(FullyQualifiedIdentifier(mapping.Mapping.TargetType.NonNullable())) ); diff --git a/src/Riok.Mapperly/Descriptors/Mappings/UserMappings/UserImplementedExistingTargetMethodMapping.cs b/src/Riok.Mapperly/Descriptors/Mappings/UserMappings/UserImplementedExistingTargetMethodMapping.cs index cd65a15e4b..fc250b6657 100644 --- a/src/Riok.Mapperly/Descriptors/Mappings/UserMappings/UserImplementedExistingTargetMethodMapping.cs +++ b/src/Riok.Mapperly/Descriptors/Mappings/UserMappings/UserImplementedExistingTargetMethodMapping.cs @@ -33,7 +33,7 @@ public override IEnumerable Build(TypeMappingBuildContext ctx, if (Method.ReceiverType?.TypeKind != TypeKind.Interface) { yield return ctx.SyntaxFactory.ExpressionStatement( - Invocation( + ctx.SyntaxFactory.Invocation( receiver == null ? IdentifierName(Method.Name) : MemberAccess(receiver, Method.Name), sourceParameter.WithArgument(ctx.Source), targetParameter.WithArgument(target), @@ -49,7 +49,7 @@ public override IEnumerable Build(TypeMappingBuildContext ctx, ); var methodExpr = MemberAccess(ParenthesizedExpression(castedThis), Method.Name); yield return ctx.SyntaxFactory.ExpressionStatement( - Invocation( + ctx.SyntaxFactory.Invocation( methodExpr, sourceParameter.WithArgument(ctx.Source), targetParameter.WithArgument(target), diff --git a/src/Riok.Mapperly/Descriptors/Mappings/UserMappings/UserImplementedMethodMapping.cs b/src/Riok.Mapperly/Descriptors/Mappings/UserMappings/UserImplementedMethodMapping.cs index 5adf0e3e5c..d504c22025 100644 --- a/src/Riok.Mapperly/Descriptors/Mappings/UserMappings/UserImplementedMethodMapping.cs +++ b/src/Riok.Mapperly/Descriptors/Mappings/UserMappings/UserImplementedMethodMapping.cs @@ -29,7 +29,7 @@ public override ExpressionSyntax Build(TypeMappingBuildContext ctx) // if the user implemented method is on an interface, // we explicitly cast to be able to use the default interface implementation or explicit implementations if (Method.ReceiverType?.TypeKind != TypeKind.Interface) - return Invocation( + return ctx.SyntaxFactory.Invocation( receiver == null ? IdentifierName(Method.Name) : MemberAccess(receiver, Method.Name), sourceParameter.WithArgument(ctx.Source), referenceHandlerParameter?.WithArgument(ctx.ReferenceHandler) @@ -40,7 +40,7 @@ public override ExpressionSyntax Build(TypeMappingBuildContext ctx) receiver == null ? ThisExpression() : IdentifierName(receiver) ); var methodExpr = MemberAccess(ParenthesizedExpression(castedReceiver), Method.Name); - return Invocation( + return ctx.SyntaxFactory.Invocation( methodExpr, sourceParameter.WithArgument(ctx.Source), referenceHandlerParameter?.WithArgument(ctx.ReferenceHandler) diff --git a/src/Riok.Mapperly/Descriptors/ObjectFactories/GenericSourceObjectFactory.cs b/src/Riok.Mapperly/Descriptors/ObjectFactories/GenericSourceObjectFactory.cs index a34abb4022..8b850977b9 100644 --- a/src/Riok.Mapperly/Descriptors/ObjectFactories/GenericSourceObjectFactory.cs +++ b/src/Riok.Mapperly/Descriptors/ObjectFactories/GenericSourceObjectFactory.cs @@ -18,5 +18,5 @@ public override bool CanCreateInstanceOfType(ITypeSymbol sourceType, ITypeSymbol && typeChecker.CheckTypes((Method.TypeParameters[0], sourceType)); protected override ExpressionSyntax BuildCreateType(ITypeSymbol sourceType, ITypeSymbol targetTypeToCreate, ExpressionSyntax source) => - GenericInvocation(Method.Name, [NonNullableIdentifier(sourceType)], source); + GenericInvocationWithoutIndention(Method.Name, [NonNullableIdentifier(sourceType)], source); } diff --git a/src/Riok.Mapperly/Descriptors/ObjectFactories/GenericSourceTargetObjectFactory.cs b/src/Riok.Mapperly/Descriptors/ObjectFactories/GenericSourceTargetObjectFactory.cs index a3f58d8cdb..472174163e 100644 --- a/src/Riok.Mapperly/Descriptors/ObjectFactories/GenericSourceTargetObjectFactory.cs +++ b/src/Riok.Mapperly/Descriptors/ObjectFactories/GenericSourceTargetObjectFactory.cs @@ -25,6 +25,6 @@ protected override ExpressionSyntax BuildCreateType(ITypeSymbol sourceType, ITyp var typeParams = new TypeSyntax[2]; typeParams[sourceTypeParameterIndex] = NonNullableIdentifier(sourceType); typeParams[_targetTypeParameterIndex] = NonNullableIdentifier(targetTypeToCreate); - return GenericInvocation(Method.Name, typeParams, source); + return GenericInvocationWithoutIndention(Method.Name, typeParams, source); } } diff --git a/src/Riok.Mapperly/Descriptors/ObjectFactories/GenericTargetObjectFactory.cs b/src/Riok.Mapperly/Descriptors/ObjectFactories/GenericTargetObjectFactory.cs index a1a1f1a199..438f3ac032 100644 --- a/src/Riok.Mapperly/Descriptors/ObjectFactories/GenericTargetObjectFactory.cs +++ b/src/Riok.Mapperly/Descriptors/ObjectFactories/GenericTargetObjectFactory.cs @@ -17,5 +17,5 @@ public override bool CanCreateInstanceOfType(ITypeSymbol sourceType, ITypeSymbol typeChecker.CheckTypes((Method.TypeParameters[0], targetTypeToCreate)); protected override ExpressionSyntax BuildCreateType(ITypeSymbol sourceType, ITypeSymbol targetTypeToCreate, ExpressionSyntax source) => - GenericInvocation(Method.Name, new[] { NonNullableIdentifier(targetTypeToCreate) }); + GenericInvocationWithoutIndention(Method.Name, [NonNullableIdentifier(targetTypeToCreate)]); } diff --git a/src/Riok.Mapperly/Descriptors/ObjectFactories/GenericTargetObjectFactoryWithSource.cs b/src/Riok.Mapperly/Descriptors/ObjectFactories/GenericTargetObjectFactoryWithSource.cs index 1369a82fe0..73abb7737e 100644 --- a/src/Riok.Mapperly/Descriptors/ObjectFactories/GenericTargetObjectFactoryWithSource.cs +++ b/src/Riok.Mapperly/Descriptors/ObjectFactories/GenericTargetObjectFactoryWithSource.cs @@ -18,5 +18,5 @@ public override bool CanCreateInstanceOfType(ITypeSymbol sourceType, ITypeSymbol && SymbolEqualityComparer.Default.Equals(Method.Parameters[0].Type, sourceType); protected override ExpressionSyntax BuildCreateType(ITypeSymbol sourceType, ITypeSymbol targetTypeToCreate, ExpressionSyntax source) => - GenericInvocation(Method.Name, new[] { NonNullableIdentifier(targetTypeToCreate) }, source); + GenericInvocationWithoutIndention(Method.Name, [NonNullableIdentifier(targetTypeToCreate)], source); } diff --git a/src/Riok.Mapperly/Descriptors/ObjectFactories/SimpleObjectFactory.cs b/src/Riok.Mapperly/Descriptors/ObjectFactories/SimpleObjectFactory.cs index 818da3f61b..4b9f7388c6 100644 --- a/src/Riok.Mapperly/Descriptors/ObjectFactories/SimpleObjectFactory.cs +++ b/src/Riok.Mapperly/Descriptors/ObjectFactories/SimpleObjectFactory.cs @@ -14,5 +14,5 @@ public override bool CanCreateInstanceOfType(ITypeSymbol sourceType, ITypeSymbol SymbolEqualityComparer.Default.Equals(Method.ReturnType, targetTypeToCreate); protected override ExpressionSyntax BuildCreateType(ITypeSymbol sourceType, ITypeSymbol targetTypeToCreate, ExpressionSyntax source) => - Invocation(Method.Name, Array.Empty()); + InvocationWithoutIndention(Method.Name); } diff --git a/src/Riok.Mapperly/Descriptors/ObjectFactories/SimpleObjectFactoryWithSource.cs b/src/Riok.Mapperly/Descriptors/ObjectFactories/SimpleObjectFactoryWithSource.cs index 121a0b5a66..a017b61666 100644 --- a/src/Riok.Mapperly/Descriptors/ObjectFactories/SimpleObjectFactoryWithSource.cs +++ b/src/Riok.Mapperly/Descriptors/ObjectFactories/SimpleObjectFactoryWithSource.cs @@ -17,5 +17,5 @@ public override bool CanCreateInstanceOfType(ITypeSymbol sourceType, ITypeSymbol && SymbolEqualityComparer.Default.Equals(sourceType, Method.Parameters[0].Type); protected override ExpressionSyntax BuildCreateType(ITypeSymbol sourceType, ITypeSymbol targetTypeToCreate, ExpressionSyntax source) => - Invocation(Method.Name, source); + InvocationWithoutIndention(Method.Name, source); } diff --git a/src/Riok.Mapperly/Descriptors/UnsafeAccess/UnsafeConstructorAccessor.cs b/src/Riok.Mapperly/Descriptors/UnsafeAccess/UnsafeConstructorAccessor.cs index 3f39cfb854..0470f2c868 100644 --- a/src/Riok.Mapperly/Descriptors/UnsafeAccess/UnsafeConstructorAccessor.cs +++ b/src/Riok.Mapperly/Descriptors/UnsafeAccess/UnsafeConstructorAccessor.cs @@ -28,6 +28,6 @@ public ExpressionSyntax CreateInstance( InitializerExpressionSyntax? initializer = null ) { - return StaticInvocation(className, methodName, args); + return ctx.SyntaxFactory.StaticInvocation(className, methodName, args); } } diff --git a/src/Riok.Mapperly/Descriptors/UnsafeAccess/UnsafeFieldAccessor.cs b/src/Riok.Mapperly/Descriptors/UnsafeAccess/UnsafeFieldAccessor.cs index d60082a37d..1c46f7410b 100644 --- a/src/Riok.Mapperly/Descriptors/UnsafeAccess/UnsafeFieldAccessor.cs +++ b/src/Riok.Mapperly/Descriptors/UnsafeAccess/UnsafeFieldAccessor.cs @@ -44,7 +44,7 @@ public ExpressionSyntax BuildAccess(ExpressionSyntax? baseAccess, bool nullCondi throw new ArgumentNullException(nameof(baseAccess)); ExpressionSyntax method = nullConditional ? ConditionalAccess(baseAccess, methodName) : MemberAccess(baseAccess, methodName); - return Invocation(method); + return InvocationWithoutIndention(method); } public ExpressionSyntax BuildAssignment(ExpressionSyntax? baseAccess, ExpressionSyntax valueToAssign, bool coalesceAssignment = false) diff --git a/src/Riok.Mapperly/Descriptors/UnsafeAccess/UnsafeGetPropertyAccessor.cs b/src/Riok.Mapperly/Descriptors/UnsafeAccess/UnsafeGetPropertyAccessor.cs index ad46fea538..e412a4ffa3 100644 --- a/src/Riok.Mapperly/Descriptors/UnsafeAccess/UnsafeGetPropertyAccessor.cs +++ b/src/Riok.Mapperly/Descriptors/UnsafeAccess/UnsafeGetPropertyAccessor.cs @@ -44,6 +44,6 @@ public ExpressionSyntax BuildAccess(ExpressionSyntax? baseAccess, bool nullCondi throw new ArgumentNullException(nameof(baseAccess)); ExpressionSyntax method = nullConditional ? ConditionalAccess(baseAccess, methodName) : MemberAccess(baseAccess, methodName); - return Invocation(method); + return InvocationWithoutIndention(method); } } diff --git a/src/Riok.Mapperly/Descriptors/UnsafeAccess/UnsafeSetPropertyAccessor.cs b/src/Riok.Mapperly/Descriptors/UnsafeAccess/UnsafeSetPropertyAccessor.cs index 3fd1c69d42..f6dce54f0b 100644 --- a/src/Riok.Mapperly/Descriptors/UnsafeAccess/UnsafeSetPropertyAccessor.cs +++ b/src/Riok.Mapperly/Descriptors/UnsafeAccess/UnsafeSetPropertyAccessor.cs @@ -50,6 +50,6 @@ public ExpressionSyntax BuildAssignment(ExpressionSyntax? baseAccess, Expression if (baseAccess == null) throw new ArgumentNullException(nameof(baseAccess)); - return Invocation(MemberAccess(baseAccess, methodName), valueToAssign); + return InvocationWithoutIndention(MemberAccess(baseAccess, methodName), valueToAssign); } } diff --git a/src/Riok.Mapperly/Emit/ReferenceHandlingSyntaxFactoryHelper.cs b/src/Riok.Mapperly/Emit/ReferenceHandlingSyntaxFactoryHelper.cs index 518db4ea4e..d26d9481ca 100644 --- a/src/Riok.Mapperly/Emit/ReferenceHandlingSyntaxFactoryHelper.cs +++ b/src/Riok.Mapperly/Emit/ReferenceHandlingSyntaxFactoryHelper.cs @@ -29,7 +29,7 @@ public static IfStatementSyntax TryGetReference(TypeMappingBuildContext ctx, IMa .WithRefOrOutKeyword(TrailingSpacedToken(SyntaxKind.OutKeyword)); // GetReference(source, out var target) - var invocation = Invocation(method, Argument(ctx.Source), targetArgument); + var invocation = ctx.SyntaxFactory.Invocation(method, Argument(ctx.Source), targetArgument); // if (_referenceHandler.GetReference(source, out var target)) // return target; @@ -46,6 +46,6 @@ public static ExpressionSyntax SetReference(IMapping mapping, TypeMappingBuildCo ); var method = MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, refHandler, methodName); - return Invocation(method, ctx.Source, target); + return ctx.SyntaxFactory.Invocation(method, ctx.Source, target); } } diff --git a/src/Riok.Mapperly/Emit/Syntax/SyntaxFactoryHelper.Exception.cs b/src/Riok.Mapperly/Emit/Syntax/SyntaxFactoryHelper.Exception.cs index f18db71081..05518258a3 100644 --- a/src/Riok.Mapperly/Emit/Syntax/SyntaxFactoryHelper.Exception.cs +++ b/src/Riok.Mapperly/Emit/Syntax/SyntaxFactoryHelper.Exception.cs @@ -17,16 +17,16 @@ public partial struct SyntaxFactoryHelper public static ThrowExpressionSyntax ThrowNullReferenceException(string message) => ThrowNullReferenceException(StringLiteral(message)); private static ThrowExpressionSyntax ThrowNullReferenceException(ExpressionSyntax arg) => - Throw(NullReferenceExceptionClassName, ArgumentList(arg)); + Throw(NullReferenceExceptionClassName, ArgumentListWithoutIndention([arg])); public static ThrowExpressionSyntax ThrowArgumentOutOfRangeException(ExpressionSyntax arg, string message) => - Throw(ArgumentOutOfRangeExceptionClassName, ArgumentList(NameOf(arg), arg, StringLiteral(message))); + Throw(ArgumentOutOfRangeExceptionClassName, ArgumentListWithoutIndention([NameOf(arg), arg, StringLiteral(message)])); public static ThrowExpressionSyntax ThrowArgumentNullException(ExpressionSyntax arg) => - Throw(ArgumentNullExceptionClassName, ArgumentList(NameOf(arg))); + Throw(ArgumentNullExceptionClassName, ArgumentListWithoutIndention([NameOf(arg)])); public static ThrowExpressionSyntax ThrowArgumentExpression(ExpressionSyntax message, ExpressionSyntax arg) => - Throw(ArgumentExceptionClassName, ArgumentList(message, NameOf(arg))); + Throw(ArgumentExceptionClassName, ArgumentListWithoutIndention([message, NameOf(arg)])); public ThrowExpressionSyntax ThrowMappingNotImplementedExceptionStatement() { diff --git a/src/Riok.Mapperly/Emit/Syntax/SyntaxFactoryHelper.Invocation.cs b/src/Riok.Mapperly/Emit/Syntax/SyntaxFactoryHelper.Invocation.cs index d109b818fa..fac43c5768 100644 --- a/src/Riok.Mapperly/Emit/Syntax/SyntaxFactoryHelper.Invocation.cs +++ b/src/Riok.Mapperly/Emit/Syntax/SyntaxFactoryHelper.Invocation.cs @@ -9,7 +9,7 @@ namespace Riok.Mapperly.Emit.Syntax; public partial struct SyntaxFactoryHelper { - public static InvocationExpressionSyntax GenericInvocation( + public InvocationExpressionSyntax GenericInvocation( string receiver, string methodName, IEnumerable typeParams, @@ -20,47 +20,51 @@ params ExpressionSyntax[] arguments return InvocationExpression(MemberAccess(IdentifierName(receiver), method)).WithArgumentList(ArgumentList(arguments)); } - public static InvocationExpressionSyntax GenericInvocation( + public static InvocationExpressionSyntax GenericInvocationWithoutIndention( string methodName, IEnumerable typeParams, params ExpressionSyntax[] arguments ) { var method = GenericName(methodName).WithTypeArgumentList(TypeArgumentList(typeParams.ToArray())); - return InvocationExpression(method).WithArgumentList(ArgumentList(arguments)); + return InvocationExpression(method).WithArgumentList(ArgumentListWithoutIndention(arguments)); } - public static InvocationExpressionSyntax Invocation(string methodName, params MethodArgument?[] arguments) => + public InvocationExpressionSyntax Invocation(string methodName, params MethodArgument?[] arguments) => Invocation(IdentifierName(methodName), arguments); - public static InvocationExpressionSyntax Invocation(ExpressionSyntax method, params MethodArgument?[] arguments) => + public InvocationExpressionSyntax Invocation(ExpressionSyntax method, params MethodArgument?[] arguments) => Invocation(method, arguments.WhereNotNull().OrderBy(x => x.Parameter.Ordinal).Select(x => x.Argument).ToArray()); - public static InvocationExpressionSyntax Invocation(string methodName, params ExpressionSyntax[] arguments) => + public InvocationExpressionSyntax Invocation(string methodName, params ExpressionSyntax[] arguments) => Invocation(IdentifierName(methodName), arguments); - public static InvocationExpressionSyntax Invocation(ExpressionSyntax method, params ExpressionSyntax[] arguments) - { - return InvocationExpression(method).WithArgumentList(ArgumentList(arguments)); - } + public static InvocationExpressionSyntax InvocationWithoutIndention(string methodName, params ExpressionSyntax[] arguments) => + InvocationWithoutIndention(IdentifierName(methodName), arguments); + + public static InvocationExpressionSyntax InvocationWithoutIndention(ExpressionSyntax method, params ExpressionSyntax[] arguments) => + InvocationExpression(method).WithArgumentList(ArgumentListWithoutIndention(arguments)); + + public InvocationExpressionSyntax Invocation(ExpressionSyntax method, params ExpressionSyntax[] arguments) => + InvocationExpression(method).WithArgumentList(ArgumentList(arguments)); - public static InvocationExpressionSyntax Invocation(string methodName) => Invocation(IdentifierName(methodName)); + public InvocationExpressionSyntax Invocation(string methodName) => Invocation(IdentifierName(methodName)); - public static InvocationExpressionSyntax Invocation(ExpressionSyntax method) => Invocation(method, Array.Empty()); + public InvocationExpressionSyntax Invocation(ExpressionSyntax method) => Invocation(method, Array.Empty()); - public static InvocationExpressionSyntax Invocation(ExpressionSyntax method, params ArgumentSyntax[] arguments) + public InvocationExpressionSyntax Invocation(ExpressionSyntax method, params ArgumentSyntax[] arguments) { return InvocationExpression(method).WithArgumentList(ArgumentList(arguments)); } - public static InvocationExpressionSyntax StaticInvocation(IMethodSymbol method, params ExpressionSyntax[] arguments) + public InvocationExpressionSyntax StaticInvocation(IMethodSymbol method, params ExpressionSyntax[] arguments) { var receiver = method.ReceiverType ?? throw new ArgumentException(nameof(method.ReceiverType) + " is null", nameof(method)); var qualifiedReceiverName = receiver.NonNullable().FullyQualifiedIdentifierName(); return StaticInvocation(qualifiedReceiverName, method.Name, arguments); } - public static InvocationExpressionSyntax StaticInvocation(IMethodSymbol method, params ArgumentSyntax[] arguments) + public InvocationExpressionSyntax StaticInvocation(IMethodSymbol method, params ArgumentSyntax[] arguments) { var receiver = method.ReceiverType ?? throw new ArgumentException(nameof(method.ReceiverType) + " is null", nameof(method)); var qualifiedReceiverName = receiver.NonNullable().FullyQualifiedIdentifierName(); @@ -126,13 +130,10 @@ public static ParameterSyntax Parameter(string type, string identifier, bool add return param; } - public static InvocationExpressionSyntax StaticInvocation( - string receiverType, - string methodName, - params ExpressionSyntax[] arguments - ) => StaticInvocation(receiverType, methodName, arguments.Select(Argument).ToArray()); + public InvocationExpressionSyntax StaticInvocation(string receiverType, string methodName, params ExpressionSyntax[] arguments) => + StaticInvocation(receiverType, methodName, arguments.Select(Argument)); - public static InvocationExpressionSyntax StaticInvocation(string receiverType, string methodName, IEnumerable arguments) + public InvocationExpressionSyntax StaticInvocation(string receiverType, string methodName, IEnumerable arguments) { var receiverTypeIdentifier = IdentifierName(receiverType); var methodAccess = MemberAccessExpression( @@ -156,17 +157,17 @@ public static ArgumentSyntax OutVarArgument(string name) .WithRefOrOutKeyword(TrailingSpacedToken(SyntaxKind.OutKeyword)); } - private static ArgumentListSyntax ArgumentList(params ExpressionSyntax[] argSyntaxes) => + private static ArgumentListSyntax ArgumentListWithoutIndention(IEnumerable argSyntaxes) => SyntaxFactory.ArgumentList(CommaSeparatedList(argSyntaxes.Select(Argument))); + private ArgumentListSyntax ArgumentList(IEnumerable argSyntaxes) => ArgumentList(argSyntaxes.Select(Argument)); + + private ArgumentListSyntax ArgumentList(IEnumerable argSyntaxes) => + SyntaxFactory.ArgumentList(ConditionalCommaLineFeedSeparatedList(argSyntaxes)); + public static TypeArgumentListSyntax TypeArgumentList(params TypeSyntax[] argSyntaxes) => SyntaxFactory.TypeArgumentList(CommaSeparatedList(argSyntaxes)); public static TypeArgumentListSyntax TypeArgumentList(IEnumerable argSyntaxes) => SyntaxFactory.TypeArgumentList(CommaSeparatedList(argSyntaxes)); - - private static ArgumentListSyntax ArgumentList(params ArgumentSyntax[] args) => SyntaxFactory.ArgumentList(CommaSeparatedList(args)); - - private static ArgumentListSyntax ArgumentList(IEnumerable args) => - SyntaxFactory.ArgumentList(CommaSeparatedList(args)); } diff --git a/src/Riok.Mapperly/Emit/Syntax/SyntaxFactoryHelper.New.cs b/src/Riok.Mapperly/Emit/Syntax/SyntaxFactoryHelper.New.cs index 59e4f9189a..826a3eefe9 100644 --- a/src/Riok.Mapperly/Emit/Syntax/SyntaxFactoryHelper.New.cs +++ b/src/Riok.Mapperly/Emit/Syntax/SyntaxFactoryHelper.New.cs @@ -13,7 +13,7 @@ public ObjectCreationExpressionSyntax CreateInstance() return CreateObject(type, SyntaxFactory.ArgumentList()); } - public static ObjectCreationExpressionSyntax CreateGenericInstance( + public ObjectCreationExpressionSyntax CreateGenericInstance( string typeName, TypeArgumentListSyntax typeArguments, IEnumerable arguments @@ -29,16 +29,13 @@ public static ObjectCreationExpressionSyntax CreateInstance(ITypeSymbol typeSymb return CreateObject(type, SyntaxFactory.ArgumentList()); } - public static ObjectCreationExpressionSyntax CreateInstance(ITypeSymbol typeSymbol, params ExpressionSyntax[] args) + public ObjectCreationExpressionSyntax CreateInstance(ITypeSymbol typeSymbol, params ExpressionSyntax[] args) { var type = NonNullableIdentifier(typeSymbol); return CreateObject(type, ArgumentList(args)); } - public static ObjectCreationExpressionSyntax CreateInstance(ITypeSymbol typeSymbol, params ArgumentSyntax[] args) => - CreateInstance(typeSymbol, (IEnumerable)args); - - public static ObjectCreationExpressionSyntax CreateInstance(ITypeSymbol typeSymbol, IEnumerable args) + public ObjectCreationExpressionSyntax CreateInstance(ITypeSymbol typeSymbol, IEnumerable args) { var type = NonNullableIdentifier(typeSymbol); return CreateObject(type, ArgumentList(args)); diff --git a/src/Riok.Mapperly/Emit/Syntax/SyntaxFactoryHelper.String.cs b/src/Riok.Mapperly/Emit/Syntax/SyntaxFactoryHelper.String.cs index 5766be286e..f74ac1a05c 100644 --- a/src/Riok.Mapperly/Emit/Syntax/SyntaxFactoryHelper.String.cs +++ b/src/Riok.Mapperly/Emit/Syntax/SyntaxFactoryHelper.String.cs @@ -15,7 +15,8 @@ public partial struct SyntaxFactoryHelper private static readonly Regex _formattableStringPlaceholder = new(@"\{(?\d+)\}", RegexOptions.Compiled, TimeSpan.FromMilliseconds(100)); - public static InvocationExpressionSyntax NameOf(ExpressionSyntax expression) => Invocation(_nameofIdentifier, expression); + public static InvocationExpressionSyntax NameOf(ExpressionSyntax expression) => + InvocationWithoutIndention(_nameofIdentifier, expression); public static IdentifierNameSyntax FullyQualifiedIdentifier(ITypeSymbol typeSymbol) => IdentifierName(typeSymbol.FullyQualifiedIdentifierName()); diff --git a/src/Riok.Mapperly/Emit/Syntax/SyntaxFactoryHelper.Token.cs b/src/Riok.Mapperly/Emit/Syntax/SyntaxFactoryHelper.Token.cs index dcedb4d0bd..e75acd8ec7 100644 --- a/src/Riok.Mapperly/Emit/Syntax/SyntaxFactoryHelper.Token.cs +++ b/src/Riok.Mapperly/Emit/Syntax/SyntaxFactoryHelper.Token.cs @@ -13,6 +13,11 @@ private SyntaxToken LeadingLineFeedToken(SyntaxKind kind) return Token(SyntaxTriviaList.Empty.AddLineFeedAndIndentation(Indentation), kind, SyntaxTriviaList.Empty); } + private SyntaxToken TrailingLineFeedToken(SyntaxKind kind, int indentation) + { + return Token(SyntaxTriviaList.Empty, kind, SyntaxTriviaList.Empty.AddLineFeedAndIndentation(indentation)); + } + private SyntaxToken LeadingLineFeedTrailingSpaceToken(SyntaxKind kind) { return Token(SyntaxTriviaList.Empty.AddLineFeedAndIndentation(Indentation), kind, _spaceTriviaList); diff --git a/src/Riok.Mapperly/Emit/Syntax/SyntaxFactoryHelper.cs b/src/Riok.Mapperly/Emit/Syntax/SyntaxFactoryHelper.cs index a039a61d03..868efcb972 100644 --- a/src/Riok.Mapperly/Emit/Syntax/SyntaxFactoryHelper.cs +++ b/src/Riok.Mapperly/Emit/Syntax/SyntaxFactoryHelper.cs @@ -8,6 +8,8 @@ namespace Riok.Mapperly.Emit.Syntax; // useful to create syntax factories: https://roslynquoter.azurewebsites.net/ and https://sharplab.io/ public readonly partial struct SyntaxFactoryHelper { + private const int ConditionalMultilineThreshold = 70; + public static readonly IdentifierNameSyntax VarIdentifier = IdentifierName("var").AddTrailingSpace(); private SyntaxFactoryHelper(int indentation) @@ -69,6 +71,27 @@ public static SeparatedSyntaxList CommaSeparatedList(params T[] nodes) return SeparatedList(joinedNodes); } + private SeparatedSyntaxList ConditionalCommaLineFeedSeparatedList(IEnumerable nodes) + where T : SyntaxNode + { + var nodesList = nodes.ToList(); + SyntaxToken sep; + if (nodesList.Sum(x => x.FullSpan.Length) < ConditionalMultilineThreshold) + { + sep = TrailingSpacedToken(SyntaxKind.CommaToken); + } + else + { + sep = TrailingLineFeedToken(SyntaxKind.CommaToken, Indentation + 1); + nodesList = nodesList.Select(n => n.AddIndentation()).ToList(); + nodesList[0] = nodesList[0].AddLeadingLineFeed(Indentation + 1); + nodesList[^1] = nodesList[^1].AddTrailingLineFeed(Indentation); + } + + var joinedNodes = Join(sep, false, nodesList); + return SeparatedList(joinedNodes); + } + private SeparatedSyntaxList CommaLineFeedSeparatedList(IEnumerable nodes) where T : SyntaxNode { diff --git a/src/Riok.Mapperly/Emit/Syntax/SyntaxIndentationExtensions.cs b/src/Riok.Mapperly/Emit/Syntax/SyntaxIndentationExtensions.cs index 94c58076b1..6499aa8d43 100644 --- a/src/Riok.Mapperly/Emit/Syntax/SyntaxIndentationExtensions.cs +++ b/src/Riok.Mapperly/Emit/Syntax/SyntaxIndentationExtensions.cs @@ -1,5 +1,6 @@ using System.Collections.Concurrent; using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; namespace Riok.Mapperly.Emit.Syntax; @@ -124,4 +125,57 @@ public static SyntaxTriviaList AddLineFeedAndIndentation(this SyntaxTriviaList t return trivia.InsertRange(0, triviaToInsert); } + + public static T AddIndentation(this T n) + where T : SyntaxNode => IndentationRewriter.Rewrite(n); + + private class IndentationRewriter : CSharpSyntaxRewriter + { + private static readonly IndentationRewriter _instance = new(); + + private IndentationRewriter() { } + + public static T Rewrite(T node) + where T : SyntaxNode + { + return (T)_instance.Visit(node); + } + + public override SyntaxTriviaList VisitList(SyntaxTriviaList list) + { + if (list.Count == 0) + return list; + + var idx = -1; + var enumerator = list.GetEnumerator(); + while (enumerator.MoveNext()) + { + idx++; + + if (!enumerator.Current.IsKind(SyntaxKind.EndOfLineTrivia)) + continue; + + var newList = new List(list.Count); + newList.AddRange(list.Take(idx + 1)); + newList.Add(_indentation); + VisitRemainingList(enumerator, newList); + return TriviaList(newList); + } + + return list; + } + + private static void VisitRemainingList(SyntaxTriviaList.Enumerator enumerator, List list) + { + while (enumerator.MoveNext()) + { + list.Add(enumerator.Current); + + if (enumerator.Current.IsKind(SyntaxKind.EndOfLineTrivia)) + { + list.Add(_indentation); + } + } + } + } } diff --git a/test/Riok.Mapperly.IntegrationTests/_snapshots/CircularReferenceMapperTest.SnapshotGeneratedSource.verified.cs b/test/Riok.Mapperly.IntegrationTests/_snapshots/CircularReferenceMapperTest.SnapshotGeneratedSource.verified.cs index b2d2dbea1f..2b397a28a1 100644 --- a/test/Riok.Mapperly.IntegrationTests/_snapshots/CircularReferenceMapperTest.SnapshotGeneratedSource.verified.cs +++ b/test/Riok.Mapperly.IntegrationTests/_snapshots/CircularReferenceMapperTest.SnapshotGeneratedSource.verified.cs @@ -7,7 +7,10 @@ public static partial class CircularReferenceMapper [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] public static partial global::Riok.Mapperly.IntegrationTests.Dto.CircularReferenceDto ToDto(global::Riok.Mapperly.IntegrationTests.Models.CircularReferenceObject obj) { - return MapToCircularReferenceDto(obj, new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler()); + return MapToCircularReferenceDto( + obj, + new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler() + ); } [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] diff --git a/test/Riok.Mapperly.IntegrationTests/_snapshots/MapperTest.SnapshotGeneratedSource.verified.cs b/test/Riok.Mapperly.IntegrationTests/_snapshots/MapperTest.SnapshotGeneratedSource.verified.cs index bb819ea827..ea918ad268 100644 --- a/test/Riok.Mapperly.IntegrationTests/_snapshots/MapperTest.SnapshotGeneratedSource.verified.cs +++ b/test/Riok.Mapperly.IntegrationTests/_snapshots/MapperTest.SnapshotGeneratedSource.verified.cs @@ -55,7 +55,10 @@ public partial int ParseableInt(string value) [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] private partial global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDto MapToDtoInternal(global::Riok.Mapperly.IntegrationTests.Models.TestObject testObject) { - var target = new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDto(DirectInt(testObject.CtorValue), ctorValue2: DirectInt(testObject.CtorValue2)) + var target = new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDto( + DirectInt(testObject.CtorValue), + ctorValue2: DirectInt(testObject.CtorValue2) + ) { IntInitOnlyValue = DirectInt(testObject.IntInitOnlyValue), RequiredValue = DirectInt(testObject.RequiredValue), @@ -130,16 +133,40 @@ public partial int ParseableInt(string value) } target.SpanValue = MapToInt32Array(testObject.SpanValue); target.MemoryValue = MapToInt32Array1(testObject.MemoryValue.Span); - target.StackValue = new global::System.Collections.Generic.Stack(global::System.Linq.Enumerable.Select(testObject.StackValue, x => ParseableInt(x))); - target.QueueValue = new global::System.Collections.Generic.Queue(global::System.Linq.Enumerable.Select(testObject.QueueValue, x => ParseableInt(x))); - target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray(global::System.Linq.Enumerable.Select(testObject.ImmutableArrayValue, x => ParseableInt(x))); - target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList(global::System.Linq.Enumerable.Select(testObject.ImmutableListValue, x => ParseableInt(x))); - target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet(global::System.Linq.Enumerable.Select(testObject.ImmutableHashSetValue, x => ParseableInt(x))); - target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange(global::System.Linq.Enumerable.Select(testObject.ImmutableQueueValue, x => ParseableInt(x))); - target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange(global::System.Linq.Enumerable.Select(testObject.ImmutableStackValue, x => ParseableInt(x))); - target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet(global::System.Linq.Enumerable.Select(testObject.ImmutableSortedSetValue, x => ParseableInt(x))); - target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary(testObject.ImmutableDictionaryValue, x => ParseableInt(x.Key), x => ParseableInt(x.Value)); - target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary(testObject.ImmutableSortedDictionaryValue, x => ParseableInt(x.Key), x => ParseableInt(x.Value)); + target.StackValue = new global::System.Collections.Generic.Stack( + global::System.Linq.Enumerable.Select(testObject.StackValue, x => ParseableInt(x)) + ); + target.QueueValue = new global::System.Collections.Generic.Queue( + global::System.Linq.Enumerable.Select(testObject.QueueValue, x => ParseableInt(x)) + ); + target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray( + global::System.Linq.Enumerable.Select(testObject.ImmutableArrayValue, x => ParseableInt(x)) + ); + target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList( + global::System.Linq.Enumerable.Select(testObject.ImmutableListValue, x => ParseableInt(x)) + ); + target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet( + global::System.Linq.Enumerable.Select(testObject.ImmutableHashSetValue, x => ParseableInt(x)) + ); + target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange( + global::System.Linq.Enumerable.Select(testObject.ImmutableQueueValue, x => ParseableInt(x)) + ); + target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange( + global::System.Linq.Enumerable.Select(testObject.ImmutableStackValue, x => ParseableInt(x)) + ); + target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet( + global::System.Linq.Enumerable.Select(testObject.ImmutableSortedSetValue, x => ParseableInt(x)) + ); + target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary( + testObject.ImmutableDictionaryValue, + x => ParseableInt(x.Key), + x => ParseableInt(x.Value) + ); + target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary( + testObject.ImmutableSortedDictionaryValue, + x => ParseableInt(x.Key), + x => ParseableInt(x.Value) + ); foreach (var item in testObject.ExistingISet) { target.ExistingISet.Add(ParseableInt(item)); @@ -156,9 +183,15 @@ public partial int ParseableInt(string value) { target.ExistingList.Add(ParseableInt(item3)); } - target.ISet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(testObject.ISet, x => ParseableInt(x))); - target.HashSet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(testObject.HashSet, x => ParseableInt(x))); - target.SortedSet = new global::System.Collections.Generic.SortedSet(global::System.Linq.Enumerable.Select(testObject.SortedSet, x => ParseableInt(x))); + target.ISet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(testObject.ISet, x => ParseableInt(x)) + ); + target.HashSet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(testObject.HashSet, x => ParseableInt(x)) + ); + target.SortedSet = new global::System.Collections.Generic.SortedSet( + global::System.Linq.Enumerable.Select(testObject.SortedSet, x => ParseableInt(x)) + ); target.EnumValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue)testObject.EnumValue; target.FlagsEnumValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestFlagsEnumDto)testObject.FlagsEnumValue; target.EnumName = MapToEnumDtoByName(testObject.EnumName); @@ -236,16 +269,40 @@ public partial int ParseableInt(string value) target.NullableReadOnlyObjectCollection = null; } target.MemoryValue = MapToStringArray(dto.MemoryValue.Span); - target.StackValue = new global::System.Collections.Generic.Stack(global::System.Linq.Enumerable.Select(dto.StackValue, x => x.ToString(_formatDeCh))); - target.QueueValue = new global::System.Collections.Generic.Queue(global::System.Linq.Enumerable.Select(dto.QueueValue, x => x.ToString(_formatDeCh))); - target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray(global::System.Linq.Enumerable.Select(dto.ImmutableArrayValue, x => x.ToString(_formatDeCh))); - target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList(global::System.Linq.Enumerable.Select(dto.ImmutableListValue, x => x.ToString(_formatDeCh))); - target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet(global::System.Linq.Enumerable.Select(dto.ImmutableHashSetValue, x => x.ToString(_formatDeCh))); - target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange(global::System.Linq.Enumerable.Select(dto.ImmutableQueueValue, x => x.ToString(_formatDeCh))); - target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange(global::System.Linq.Enumerable.Select(dto.ImmutableStackValue, x => x.ToString(_formatDeCh))); - target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet(global::System.Linq.Enumerable.Select(dto.ImmutableSortedSetValue, x => x.ToString(_formatDeCh))); - target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary(dto.ImmutableDictionaryValue, x => x.Key.ToString(_formatDeCh), x => x.Value.ToString(_formatDeCh)); - target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary(dto.ImmutableSortedDictionaryValue, x => x.Key.ToString(_formatDeCh), x => x.Value.ToString(_formatDeCh)); + target.StackValue = new global::System.Collections.Generic.Stack( + global::System.Linq.Enumerable.Select(dto.StackValue, x => x.ToString(_formatDeCh)) + ); + target.QueueValue = new global::System.Collections.Generic.Queue( + global::System.Linq.Enumerable.Select(dto.QueueValue, x => x.ToString(_formatDeCh)) + ); + target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray( + global::System.Linq.Enumerable.Select(dto.ImmutableArrayValue, x => x.ToString(_formatDeCh)) + ); + target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList( + global::System.Linq.Enumerable.Select(dto.ImmutableListValue, x => x.ToString(_formatDeCh)) + ); + target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet( + global::System.Linq.Enumerable.Select(dto.ImmutableHashSetValue, x => x.ToString(_formatDeCh)) + ); + target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange( + global::System.Linq.Enumerable.Select(dto.ImmutableQueueValue, x => x.ToString(_formatDeCh)) + ); + target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange( + global::System.Linq.Enumerable.Select(dto.ImmutableStackValue, x => x.ToString(_formatDeCh)) + ); + target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet( + global::System.Linq.Enumerable.Select(dto.ImmutableSortedSetValue, x => x.ToString(_formatDeCh)) + ); + target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary( + dto.ImmutableDictionaryValue, + x => x.Key.ToString(_formatDeCh), + x => x.Value.ToString(_formatDeCh) + ); + target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary( + dto.ImmutableSortedDictionaryValue, + x => x.Key.ToString(_formatDeCh), + x => x.Value.ToString(_formatDeCh) + ); foreach (var item in dto.ExistingISet) { target.ExistingISet.Add(item.ToString(_formatDeCh)); @@ -262,9 +319,15 @@ public partial int ParseableInt(string value) { target.ExistingList.Add(item3.ToString(_formatDeCh)); } - target.ISet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(dto.ISet, x => x.ToString(_formatDeCh))); - target.HashSet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(dto.HashSet, x => x.ToString(_formatDeCh))); - target.SortedSet = new global::System.Collections.Generic.SortedSet(global::System.Linq.Enumerable.Select(dto.SortedSet, x => x.ToString(_formatDeCh))); + target.ISet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(dto.ISet, x => x.ToString(_formatDeCh)) + ); + target.HashSet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(dto.HashSet, x => x.ToString(_formatDeCh)) + ); + target.SortedSet = new global::System.Collections.Generic.SortedSet( + global::System.Linq.Enumerable.Select(dto.SortedSet, x => x.ToString(_formatDeCh)) + ); target.EnumValue = (global::Riok.Mapperly.IntegrationTests.Models.TestEnum)dto.EnumValue; target.FlagsEnumValue = (global::Riok.Mapperly.IntegrationTests.Models.TestFlagsEnum)dto.FlagsEnumValue; target.EnumName = (global::Riok.Mapperly.IntegrationTests.Models.TestEnum)dto.EnumName; @@ -342,16 +405,40 @@ public partial void UpdateDto(global::Riok.Mapperly.IntegrationTests.Models.Test } target.SpanValue = MapToInt32Array(source.SpanValue); target.MemoryValue = MapToInt32Array1(source.MemoryValue.Span); - target.StackValue = new global::System.Collections.Generic.Stack(global::System.Linq.Enumerable.Select(source.StackValue, x => ParseableInt(x))); - target.QueueValue = new global::System.Collections.Generic.Queue(global::System.Linq.Enumerable.Select(source.QueueValue, x => ParseableInt(x))); - target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray(global::System.Linq.Enumerable.Select(source.ImmutableArrayValue, x => ParseableInt(x))); - target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList(global::System.Linq.Enumerable.Select(source.ImmutableListValue, x => ParseableInt(x))); - target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet(global::System.Linq.Enumerable.Select(source.ImmutableHashSetValue, x => ParseableInt(x))); - target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange(global::System.Linq.Enumerable.Select(source.ImmutableQueueValue, x => ParseableInt(x))); - target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange(global::System.Linq.Enumerable.Select(source.ImmutableStackValue, x => ParseableInt(x))); - target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet(global::System.Linq.Enumerable.Select(source.ImmutableSortedSetValue, x => ParseableInt(x))); - target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary(source.ImmutableDictionaryValue, x => ParseableInt(x.Key), x => ParseableInt(x.Value)); - target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary(source.ImmutableSortedDictionaryValue, x => ParseableInt(x.Key), x => ParseableInt(x.Value)); + target.StackValue = new global::System.Collections.Generic.Stack( + global::System.Linq.Enumerable.Select(source.StackValue, x => ParseableInt(x)) + ); + target.QueueValue = new global::System.Collections.Generic.Queue( + global::System.Linq.Enumerable.Select(source.QueueValue, x => ParseableInt(x)) + ); + target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray( + global::System.Linq.Enumerable.Select(source.ImmutableArrayValue, x => ParseableInt(x)) + ); + target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList( + global::System.Linq.Enumerable.Select(source.ImmutableListValue, x => ParseableInt(x)) + ); + target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet( + global::System.Linq.Enumerable.Select(source.ImmutableHashSetValue, x => ParseableInt(x)) + ); + target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange( + global::System.Linq.Enumerable.Select(source.ImmutableQueueValue, x => ParseableInt(x)) + ); + target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange( + global::System.Linq.Enumerable.Select(source.ImmutableStackValue, x => ParseableInt(x)) + ); + target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet( + global::System.Linq.Enumerable.Select(source.ImmutableSortedSetValue, x => ParseableInt(x)) + ); + target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary( + source.ImmutableDictionaryValue, + x => ParseableInt(x.Key), + x => ParseableInt(x.Value) + ); + target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary( + source.ImmutableSortedDictionaryValue, + x => ParseableInt(x.Key), + x => ParseableInt(x.Value) + ); foreach (var item in source.ExistingISet) { target.ExistingISet.Add(ParseableInt(item)); @@ -368,9 +455,15 @@ public partial void UpdateDto(global::Riok.Mapperly.IntegrationTests.Models.Test { target.ExistingList.Add(ParseableInt(item3)); } - target.ISet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(source.ISet, x => ParseableInt(x))); - target.HashSet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(source.HashSet, x => ParseableInt(x))); - target.SortedSet = new global::System.Collections.Generic.SortedSet(global::System.Linq.Enumerable.Select(source.SortedSet, x => ParseableInt(x))); + target.ISet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(source.ISet, x => ParseableInt(x)) + ); + target.HashSet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(source.HashSet, x => ParseableInt(x)) + ); + target.SortedSet = new global::System.Collections.Generic.SortedSet( + global::System.Linq.Enumerable.Select(source.SortedSet, x => ParseableInt(x)) + ); target.EnumValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue)source.EnumValue; target.FlagsEnumValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestFlagsEnumDto)source.FlagsEnumValue; target.EnumName = MapToEnumDtoByName(source.EnumName); @@ -477,7 +570,11 @@ private string MapToString(global::Riok.Mapperly.IntegrationTests.Models.TestEnu nameof(global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue.DtoValue1) => global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue.DtoValue1, nameof(global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue.DtoValue2) => global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue.DtoValue2, nameof(global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue.DtoValue3) => global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue.DtoValue3, - _ => (global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue)System.Enum.Parse(typeof(global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue), source, false), + _ => (global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue)System.Enum.Parse( + typeof(global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue), + source, + false + ), }; } @@ -535,7 +632,11 @@ private string[] MapToStringArray(global::System.ReadOnlySpan source) nameof(global::Riok.Mapperly.IntegrationTests.Models.TestEnum.Value10) => global::Riok.Mapperly.IntegrationTests.Models.TestEnum.Value10, nameof(global::Riok.Mapperly.IntegrationTests.Models.TestEnum.Value20) => global::Riok.Mapperly.IntegrationTests.Models.TestEnum.Value20, nameof(global::Riok.Mapperly.IntegrationTests.Models.TestEnum.Value30) => global::Riok.Mapperly.IntegrationTests.Models.TestEnum.Value30, - _ => (global::Riok.Mapperly.IntegrationTests.Models.TestEnum)System.Enum.Parse(typeof(global::Riok.Mapperly.IntegrationTests.Models.TestEnum), source, false), + _ => (global::Riok.Mapperly.IntegrationTests.Models.TestEnum)System.Enum.Parse( + typeof(global::Riok.Mapperly.IntegrationTests.Models.TestEnum), + source, + false + ), }; } diff --git a/test/Riok.Mapperly.IntegrationTests/_snapshots/MapperTest.SnapshotGeneratedSource_NET6_0.verified.cs b/test/Riok.Mapperly.IntegrationTests/_snapshots/MapperTest.SnapshotGeneratedSource_NET6_0.verified.cs index 7fc762f333..9594de4ef7 100644 --- a/test/Riok.Mapperly.IntegrationTests/_snapshots/MapperTest.SnapshotGeneratedSource_NET6_0.verified.cs +++ b/test/Riok.Mapperly.IntegrationTests/_snapshots/MapperTest.SnapshotGeneratedSource_NET6_0.verified.cs @@ -55,7 +55,10 @@ public partial int ParseableInt(string value) [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] private partial global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDto MapToDtoInternal(global::Riok.Mapperly.IntegrationTests.Models.TestObject testObject) { - var target = new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDto(DirectInt(testObject.CtorValue), ctorValue2: DirectInt(testObject.CtorValue2)) + var target = new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDto( + DirectInt(testObject.CtorValue), + ctorValue2: DirectInt(testObject.CtorValue2) + ) { IntInitOnlyValue = DirectInt(testObject.IntInitOnlyValue), RequiredValue = DirectInt(testObject.RequiredValue), @@ -130,16 +133,40 @@ public partial int ParseableInt(string value) } target.SpanValue = MapToInt32Array(testObject.SpanValue); target.MemoryValue = MapToInt32Array1(testObject.MemoryValue.Span); - target.StackValue = new global::System.Collections.Generic.Stack(global::System.Linq.Enumerable.Select(testObject.StackValue, x => ParseableInt(x))); - target.QueueValue = new global::System.Collections.Generic.Queue(global::System.Linq.Enumerable.Select(testObject.QueueValue, x => ParseableInt(x))); - target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray(global::System.Linq.Enumerable.Select(testObject.ImmutableArrayValue, x => ParseableInt(x))); - target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList(global::System.Linq.Enumerable.Select(testObject.ImmutableListValue, x => ParseableInt(x))); - target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet(global::System.Linq.Enumerable.Select(testObject.ImmutableHashSetValue, x => ParseableInt(x))); - target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange(global::System.Linq.Enumerable.Select(testObject.ImmutableQueueValue, x => ParseableInt(x))); - target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange(global::System.Linq.Enumerable.Select(testObject.ImmutableStackValue, x => ParseableInt(x))); - target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet(global::System.Linq.Enumerable.Select(testObject.ImmutableSortedSetValue, x => ParseableInt(x))); - target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary(testObject.ImmutableDictionaryValue, x => ParseableInt(x.Key), x => ParseableInt(x.Value)); - target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary(testObject.ImmutableSortedDictionaryValue, x => ParseableInt(x.Key), x => ParseableInt(x.Value)); + target.StackValue = new global::System.Collections.Generic.Stack( + global::System.Linq.Enumerable.Select(testObject.StackValue, x => ParseableInt(x)) + ); + target.QueueValue = new global::System.Collections.Generic.Queue( + global::System.Linq.Enumerable.Select(testObject.QueueValue, x => ParseableInt(x)) + ); + target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray( + global::System.Linq.Enumerable.Select(testObject.ImmutableArrayValue, x => ParseableInt(x)) + ); + target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList( + global::System.Linq.Enumerable.Select(testObject.ImmutableListValue, x => ParseableInt(x)) + ); + target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet( + global::System.Linq.Enumerable.Select(testObject.ImmutableHashSetValue, x => ParseableInt(x)) + ); + target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange( + global::System.Linq.Enumerable.Select(testObject.ImmutableQueueValue, x => ParseableInt(x)) + ); + target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange( + global::System.Linq.Enumerable.Select(testObject.ImmutableStackValue, x => ParseableInt(x)) + ); + target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet( + global::System.Linq.Enumerable.Select(testObject.ImmutableSortedSetValue, x => ParseableInt(x)) + ); + target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary( + testObject.ImmutableDictionaryValue, + x => ParseableInt(x.Key), + x => ParseableInt(x.Value) + ); + target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary( + testObject.ImmutableSortedDictionaryValue, + x => ParseableInt(x.Key), + x => ParseableInt(x.Value) + ); foreach (var item in testObject.ExistingISet) { target.ExistingISet.Add(ParseableInt(item)); @@ -158,10 +185,18 @@ public partial int ParseableInt(string value) { target.ExistingList.Add(ParseableInt(item3)); } - target.ISet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(testObject.ISet, x => ParseableInt(x))); - target.IReadOnlySet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(testObject.IReadOnlySet, x => ParseableInt(x))); - target.HashSet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(testObject.HashSet, x => ParseableInt(x))); - target.SortedSet = new global::System.Collections.Generic.SortedSet(global::System.Linq.Enumerable.Select(testObject.SortedSet, x => ParseableInt(x))); + target.ISet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(testObject.ISet, x => ParseableInt(x)) + ); + target.IReadOnlySet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(testObject.IReadOnlySet, x => ParseableInt(x)) + ); + target.HashSet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(testObject.HashSet, x => ParseableInt(x)) + ); + target.SortedSet = new global::System.Collections.Generic.SortedSet( + global::System.Linq.Enumerable.Select(testObject.SortedSet, x => ParseableInt(x)) + ); target.EnumValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue)testObject.EnumValue; target.FlagsEnumValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestFlagsEnumDto)testObject.FlagsEnumValue; target.EnumName = MapToEnumDtoByName(testObject.EnumName); @@ -239,16 +274,40 @@ public partial int ParseableInt(string value) target.NullableReadOnlyObjectCollection = null; } target.MemoryValue = MapToStringArray(dto.MemoryValue.Span); - target.StackValue = new global::System.Collections.Generic.Stack(global::System.Linq.Enumerable.Select(dto.StackValue, x => x.ToString(_formatDeCh))); - target.QueueValue = new global::System.Collections.Generic.Queue(global::System.Linq.Enumerable.Select(dto.QueueValue, x => x.ToString(_formatDeCh))); - target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray(global::System.Linq.Enumerable.Select(dto.ImmutableArrayValue, x => x.ToString(_formatDeCh))); - target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList(global::System.Linq.Enumerable.Select(dto.ImmutableListValue, x => x.ToString(_formatDeCh))); - target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet(global::System.Linq.Enumerable.Select(dto.ImmutableHashSetValue, x => x.ToString(_formatDeCh))); - target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange(global::System.Linq.Enumerable.Select(dto.ImmutableQueueValue, x => x.ToString(_formatDeCh))); - target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange(global::System.Linq.Enumerable.Select(dto.ImmutableStackValue, x => x.ToString(_formatDeCh))); - target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet(global::System.Linq.Enumerable.Select(dto.ImmutableSortedSetValue, x => x.ToString(_formatDeCh))); - target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary(dto.ImmutableDictionaryValue, x => x.Key.ToString(_formatDeCh), x => x.Value.ToString(_formatDeCh)); - target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary(dto.ImmutableSortedDictionaryValue, x => x.Key.ToString(_formatDeCh), x => x.Value.ToString(_formatDeCh)); + target.StackValue = new global::System.Collections.Generic.Stack( + global::System.Linq.Enumerable.Select(dto.StackValue, x => x.ToString(_formatDeCh)) + ); + target.QueueValue = new global::System.Collections.Generic.Queue( + global::System.Linq.Enumerable.Select(dto.QueueValue, x => x.ToString(_formatDeCh)) + ); + target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray( + global::System.Linq.Enumerable.Select(dto.ImmutableArrayValue, x => x.ToString(_formatDeCh)) + ); + target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList( + global::System.Linq.Enumerable.Select(dto.ImmutableListValue, x => x.ToString(_formatDeCh)) + ); + target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet( + global::System.Linq.Enumerable.Select(dto.ImmutableHashSetValue, x => x.ToString(_formatDeCh)) + ); + target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange( + global::System.Linq.Enumerable.Select(dto.ImmutableQueueValue, x => x.ToString(_formatDeCh)) + ); + target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange( + global::System.Linq.Enumerable.Select(dto.ImmutableStackValue, x => x.ToString(_formatDeCh)) + ); + target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet( + global::System.Linq.Enumerable.Select(dto.ImmutableSortedSetValue, x => x.ToString(_formatDeCh)) + ); + target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary( + dto.ImmutableDictionaryValue, + x => x.Key.ToString(_formatDeCh), + x => x.Value.ToString(_formatDeCh) + ); + target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary( + dto.ImmutableSortedDictionaryValue, + x => x.Key.ToString(_formatDeCh), + x => x.Value.ToString(_formatDeCh) + ); foreach (var item in dto.ExistingISet) { target.ExistingISet.Add(item.ToString(_formatDeCh)); @@ -267,10 +326,18 @@ public partial int ParseableInt(string value) { target.ExistingList.Add(item3.ToString(_formatDeCh)); } - target.ISet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(dto.ISet, x => x.ToString(_formatDeCh))); - target.IReadOnlySet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(dto.IReadOnlySet, x => x.ToString(_formatDeCh))); - target.HashSet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(dto.HashSet, x => x.ToString(_formatDeCh))); - target.SortedSet = new global::System.Collections.Generic.SortedSet(global::System.Linq.Enumerable.Select(dto.SortedSet, x => x.ToString(_formatDeCh))); + target.ISet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(dto.ISet, x => x.ToString(_formatDeCh)) + ); + target.IReadOnlySet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(dto.IReadOnlySet, x => x.ToString(_formatDeCh)) + ); + target.HashSet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(dto.HashSet, x => x.ToString(_formatDeCh)) + ); + target.SortedSet = new global::System.Collections.Generic.SortedSet( + global::System.Linq.Enumerable.Select(dto.SortedSet, x => x.ToString(_formatDeCh)) + ); target.EnumValue = (global::Riok.Mapperly.IntegrationTests.Models.TestEnum)dto.EnumValue; target.FlagsEnumValue = (global::Riok.Mapperly.IntegrationTests.Models.TestFlagsEnum)dto.FlagsEnumValue; target.EnumName = (global::Riok.Mapperly.IntegrationTests.Models.TestEnum)dto.EnumName; @@ -348,16 +415,40 @@ public partial void UpdateDto(global::Riok.Mapperly.IntegrationTests.Models.Test } target.SpanValue = MapToInt32Array(source.SpanValue); target.MemoryValue = MapToInt32Array1(source.MemoryValue.Span); - target.StackValue = new global::System.Collections.Generic.Stack(global::System.Linq.Enumerable.Select(source.StackValue, x => ParseableInt(x))); - target.QueueValue = new global::System.Collections.Generic.Queue(global::System.Linq.Enumerable.Select(source.QueueValue, x => ParseableInt(x))); - target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray(global::System.Linq.Enumerable.Select(source.ImmutableArrayValue, x => ParseableInt(x))); - target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList(global::System.Linq.Enumerable.Select(source.ImmutableListValue, x => ParseableInt(x))); - target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet(global::System.Linq.Enumerable.Select(source.ImmutableHashSetValue, x => ParseableInt(x))); - target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange(global::System.Linq.Enumerable.Select(source.ImmutableQueueValue, x => ParseableInt(x))); - target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange(global::System.Linq.Enumerable.Select(source.ImmutableStackValue, x => ParseableInt(x))); - target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet(global::System.Linq.Enumerable.Select(source.ImmutableSortedSetValue, x => ParseableInt(x))); - target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary(source.ImmutableDictionaryValue, x => ParseableInt(x.Key), x => ParseableInt(x.Value)); - target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary(source.ImmutableSortedDictionaryValue, x => ParseableInt(x.Key), x => ParseableInt(x.Value)); + target.StackValue = new global::System.Collections.Generic.Stack( + global::System.Linq.Enumerable.Select(source.StackValue, x => ParseableInt(x)) + ); + target.QueueValue = new global::System.Collections.Generic.Queue( + global::System.Linq.Enumerable.Select(source.QueueValue, x => ParseableInt(x)) + ); + target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray( + global::System.Linq.Enumerable.Select(source.ImmutableArrayValue, x => ParseableInt(x)) + ); + target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList( + global::System.Linq.Enumerable.Select(source.ImmutableListValue, x => ParseableInt(x)) + ); + target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet( + global::System.Linq.Enumerable.Select(source.ImmutableHashSetValue, x => ParseableInt(x)) + ); + target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange( + global::System.Linq.Enumerable.Select(source.ImmutableQueueValue, x => ParseableInt(x)) + ); + target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange( + global::System.Linq.Enumerable.Select(source.ImmutableStackValue, x => ParseableInt(x)) + ); + target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet( + global::System.Linq.Enumerable.Select(source.ImmutableSortedSetValue, x => ParseableInt(x)) + ); + target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary( + source.ImmutableDictionaryValue, + x => ParseableInt(x.Key), + x => ParseableInt(x.Value) + ); + target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary( + source.ImmutableSortedDictionaryValue, + x => ParseableInt(x.Key), + x => ParseableInt(x.Value) + ); foreach (var item in source.ExistingISet) { target.ExistingISet.Add(ParseableInt(item)); @@ -376,10 +467,18 @@ public partial void UpdateDto(global::Riok.Mapperly.IntegrationTests.Models.Test { target.ExistingList.Add(ParseableInt(item3)); } - target.ISet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(source.ISet, x => ParseableInt(x))); - target.IReadOnlySet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(source.IReadOnlySet, x => ParseableInt(x))); - target.HashSet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(source.HashSet, x => ParseableInt(x))); - target.SortedSet = new global::System.Collections.Generic.SortedSet(global::System.Linq.Enumerable.Select(source.SortedSet, x => ParseableInt(x))); + target.ISet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(source.ISet, x => ParseableInt(x)) + ); + target.IReadOnlySet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(source.IReadOnlySet, x => ParseableInt(x)) + ); + target.HashSet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(source.HashSet, x => ParseableInt(x)) + ); + target.SortedSet = new global::System.Collections.Generic.SortedSet( + global::System.Linq.Enumerable.Select(source.SortedSet, x => ParseableInt(x)) + ); target.EnumValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue)source.EnumValue; target.FlagsEnumValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestFlagsEnumDto)source.FlagsEnumValue; target.EnumName = MapToEnumDtoByName(source.EnumName); diff --git a/test/Riok.Mapperly.IntegrationTests/_snapshots/MapperTest.SnapshotGeneratedSource_NET8_0.verified.cs b/test/Riok.Mapperly.IntegrationTests/_snapshots/MapperTest.SnapshotGeneratedSource_NET8_0.verified.cs index f53dc1e283..76e1d2007c 100644 --- a/test/Riok.Mapperly.IntegrationTests/_snapshots/MapperTest.SnapshotGeneratedSource_NET8_0.verified.cs +++ b/test/Riok.Mapperly.IntegrationTests/_snapshots/MapperTest.SnapshotGeneratedSource_NET8_0.verified.cs @@ -55,7 +55,10 @@ public partial int ParseableInt(string value) [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] private partial global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDto MapToDtoInternal(global::Riok.Mapperly.IntegrationTests.Models.TestObject testObject) { - var target = new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDto(DirectInt(testObject.CtorValue), ctorValue2: DirectInt(testObject.CtorValue2)) + var target = new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDto( + DirectInt(testObject.CtorValue), + ctorValue2: DirectInt(testObject.CtorValue2) + ) { IntInitOnlyValue = DirectInt(testObject.IntInitOnlyValue), RequiredValue = DirectInt(testObject.RequiredValue), @@ -130,16 +133,40 @@ public partial int ParseableInt(string value) } target.SpanValue = MapToInt32Array(testObject.SpanValue); target.MemoryValue = MapToInt32Array1(testObject.MemoryValue.Span); - target.StackValue = new global::System.Collections.Generic.Stack(global::System.Linq.Enumerable.Select(testObject.StackValue, x => ParseableInt(x))); - target.QueueValue = new global::System.Collections.Generic.Queue(global::System.Linq.Enumerable.Select(testObject.QueueValue, x => ParseableInt(x))); - target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray(global::System.Linq.Enumerable.Select(testObject.ImmutableArrayValue, x => ParseableInt(x))); - target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList(global::System.Linq.Enumerable.Select(testObject.ImmutableListValue, x => ParseableInt(x))); - target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet(global::System.Linq.Enumerable.Select(testObject.ImmutableHashSetValue, x => ParseableInt(x))); - target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange(global::System.Linq.Enumerable.Select(testObject.ImmutableQueueValue, x => ParseableInt(x))); - target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange(global::System.Linq.Enumerable.Select(testObject.ImmutableStackValue, x => ParseableInt(x))); - target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet(global::System.Linq.Enumerable.Select(testObject.ImmutableSortedSetValue, x => ParseableInt(x))); - target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary(testObject.ImmutableDictionaryValue, x => ParseableInt(x.Key), x => ParseableInt(x.Value)); - target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary(testObject.ImmutableSortedDictionaryValue, x => ParseableInt(x.Key), x => ParseableInt(x.Value)); + target.StackValue = new global::System.Collections.Generic.Stack( + global::System.Linq.Enumerable.Select(testObject.StackValue, x => ParseableInt(x)) + ); + target.QueueValue = new global::System.Collections.Generic.Queue( + global::System.Linq.Enumerable.Select(testObject.QueueValue, x => ParseableInt(x)) + ); + target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray( + global::System.Linq.Enumerable.Select(testObject.ImmutableArrayValue, x => ParseableInt(x)) + ); + target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList( + global::System.Linq.Enumerable.Select(testObject.ImmutableListValue, x => ParseableInt(x)) + ); + target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet( + global::System.Linq.Enumerable.Select(testObject.ImmutableHashSetValue, x => ParseableInt(x)) + ); + target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange( + global::System.Linq.Enumerable.Select(testObject.ImmutableQueueValue, x => ParseableInt(x)) + ); + target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange( + global::System.Linq.Enumerable.Select(testObject.ImmutableStackValue, x => ParseableInt(x)) + ); + target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet( + global::System.Linq.Enumerable.Select(testObject.ImmutableSortedSetValue, x => ParseableInt(x)) + ); + target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary( + testObject.ImmutableDictionaryValue, + x => ParseableInt(x.Key), + x => ParseableInt(x.Value) + ); + target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary( + testObject.ImmutableSortedDictionaryValue, + x => ParseableInt(x.Key), + x => ParseableInt(x.Value) + ); foreach (var item in testObject.ExistingISet) { target.ExistingISet.Add(ParseableInt(item)); @@ -158,10 +185,18 @@ public partial int ParseableInt(string value) { target.ExistingList.Add(ParseableInt(item3)); } - target.ISet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(testObject.ISet, x => ParseableInt(x))); - target.IReadOnlySet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(testObject.IReadOnlySet, x => ParseableInt(x))); - target.HashSet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(testObject.HashSet, x => ParseableInt(x))); - target.SortedSet = new global::System.Collections.Generic.SortedSet(global::System.Linq.Enumerable.Select(testObject.SortedSet, x => ParseableInt(x))); + target.ISet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(testObject.ISet, x => ParseableInt(x)) + ); + target.IReadOnlySet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(testObject.IReadOnlySet, x => ParseableInt(x)) + ); + target.HashSet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(testObject.HashSet, x => ParseableInt(x)) + ); + target.SortedSet = new global::System.Collections.Generic.SortedSet( + global::System.Linq.Enumerable.Select(testObject.SortedSet, x => ParseableInt(x)) + ); target.EnumValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue)testObject.EnumValue; target.FlagsEnumValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestFlagsEnumDto)testObject.FlagsEnumValue; target.EnumName = MapToEnumDtoByName(testObject.EnumName); @@ -240,16 +275,40 @@ public partial int ParseableInt(string value) target.NullableReadOnlyObjectCollection = null; } target.MemoryValue = MapToStringArray(dto.MemoryValue.Span); - target.StackValue = new global::System.Collections.Generic.Stack(global::System.Linq.Enumerable.Select(dto.StackValue, x => x.ToString(_formatDeCh))); - target.QueueValue = new global::System.Collections.Generic.Queue(global::System.Linq.Enumerable.Select(dto.QueueValue, x => x.ToString(_formatDeCh))); - target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray(global::System.Linq.Enumerable.Select(dto.ImmutableArrayValue, x => x.ToString(_formatDeCh))); - target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList(global::System.Linq.Enumerable.Select(dto.ImmutableListValue, x => x.ToString(_formatDeCh))); - target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet(global::System.Linq.Enumerable.Select(dto.ImmutableHashSetValue, x => x.ToString(_formatDeCh))); - target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange(global::System.Linq.Enumerable.Select(dto.ImmutableQueueValue, x => x.ToString(_formatDeCh))); - target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange(global::System.Linq.Enumerable.Select(dto.ImmutableStackValue, x => x.ToString(_formatDeCh))); - target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet(global::System.Linq.Enumerable.Select(dto.ImmutableSortedSetValue, x => x.ToString(_formatDeCh))); - target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary(dto.ImmutableDictionaryValue, x => x.Key.ToString(_formatDeCh), x => x.Value.ToString(_formatDeCh)); - target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary(dto.ImmutableSortedDictionaryValue, x => x.Key.ToString(_formatDeCh), x => x.Value.ToString(_formatDeCh)); + target.StackValue = new global::System.Collections.Generic.Stack( + global::System.Linq.Enumerable.Select(dto.StackValue, x => x.ToString(_formatDeCh)) + ); + target.QueueValue = new global::System.Collections.Generic.Queue( + global::System.Linq.Enumerable.Select(dto.QueueValue, x => x.ToString(_formatDeCh)) + ); + target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray( + global::System.Linq.Enumerable.Select(dto.ImmutableArrayValue, x => x.ToString(_formatDeCh)) + ); + target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList( + global::System.Linq.Enumerable.Select(dto.ImmutableListValue, x => x.ToString(_formatDeCh)) + ); + target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet( + global::System.Linq.Enumerable.Select(dto.ImmutableHashSetValue, x => x.ToString(_formatDeCh)) + ); + target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange( + global::System.Linq.Enumerable.Select(dto.ImmutableQueueValue, x => x.ToString(_formatDeCh)) + ); + target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange( + global::System.Linq.Enumerable.Select(dto.ImmutableStackValue, x => x.ToString(_formatDeCh)) + ); + target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet( + global::System.Linq.Enumerable.Select(dto.ImmutableSortedSetValue, x => x.ToString(_formatDeCh)) + ); + target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary( + dto.ImmutableDictionaryValue, + x => x.Key.ToString(_formatDeCh), + x => x.Value.ToString(_formatDeCh) + ); + target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary( + dto.ImmutableSortedDictionaryValue, + x => x.Key.ToString(_formatDeCh), + x => x.Value.ToString(_formatDeCh) + ); foreach (var item in dto.ExistingISet) { target.ExistingISet.Add(item.ToString(_formatDeCh)); @@ -268,10 +327,18 @@ public partial int ParseableInt(string value) { target.ExistingList.Add(item3.ToString(_formatDeCh)); } - target.ISet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(dto.ISet, x => x.ToString(_formatDeCh))); - target.IReadOnlySet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(dto.IReadOnlySet, x => x.ToString(_formatDeCh))); - target.HashSet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(dto.HashSet, x => x.ToString(_formatDeCh))); - target.SortedSet = new global::System.Collections.Generic.SortedSet(global::System.Linq.Enumerable.Select(dto.SortedSet, x => x.ToString(_formatDeCh))); + target.ISet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(dto.ISet, x => x.ToString(_formatDeCh)) + ); + target.IReadOnlySet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(dto.IReadOnlySet, x => x.ToString(_formatDeCh)) + ); + target.HashSet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(dto.HashSet, x => x.ToString(_formatDeCh)) + ); + target.SortedSet = new global::System.Collections.Generic.SortedSet( + global::System.Linq.Enumerable.Select(dto.SortedSet, x => x.ToString(_formatDeCh)) + ); target.EnumValue = (global::Riok.Mapperly.IntegrationTests.Models.TestEnum)dto.EnumValue; target.FlagsEnumValue = (global::Riok.Mapperly.IntegrationTests.Models.TestFlagsEnum)dto.FlagsEnumValue; target.EnumName = (global::Riok.Mapperly.IntegrationTests.Models.TestEnum)dto.EnumName; @@ -350,16 +417,40 @@ public partial void UpdateDto(global::Riok.Mapperly.IntegrationTests.Models.Test } target.SpanValue = MapToInt32Array(source.SpanValue); target.MemoryValue = MapToInt32Array1(source.MemoryValue.Span); - target.StackValue = new global::System.Collections.Generic.Stack(global::System.Linq.Enumerable.Select(source.StackValue, x => ParseableInt(x))); - target.QueueValue = new global::System.Collections.Generic.Queue(global::System.Linq.Enumerable.Select(source.QueueValue, x => ParseableInt(x))); - target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray(global::System.Linq.Enumerable.Select(source.ImmutableArrayValue, x => ParseableInt(x))); - target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList(global::System.Linq.Enumerable.Select(source.ImmutableListValue, x => ParseableInt(x))); - target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet(global::System.Linq.Enumerable.Select(source.ImmutableHashSetValue, x => ParseableInt(x))); - target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange(global::System.Linq.Enumerable.Select(source.ImmutableQueueValue, x => ParseableInt(x))); - target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange(global::System.Linq.Enumerable.Select(source.ImmutableStackValue, x => ParseableInt(x))); - target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet(global::System.Linq.Enumerable.Select(source.ImmutableSortedSetValue, x => ParseableInt(x))); - target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary(source.ImmutableDictionaryValue, x => ParseableInt(x.Key), x => ParseableInt(x.Value)); - target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary(source.ImmutableSortedDictionaryValue, x => ParseableInt(x.Key), x => ParseableInt(x.Value)); + target.StackValue = new global::System.Collections.Generic.Stack( + global::System.Linq.Enumerable.Select(source.StackValue, x => ParseableInt(x)) + ); + target.QueueValue = new global::System.Collections.Generic.Queue( + global::System.Linq.Enumerable.Select(source.QueueValue, x => ParseableInt(x)) + ); + target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray( + global::System.Linq.Enumerable.Select(source.ImmutableArrayValue, x => ParseableInt(x)) + ); + target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList( + global::System.Linq.Enumerable.Select(source.ImmutableListValue, x => ParseableInt(x)) + ); + target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet( + global::System.Linq.Enumerable.Select(source.ImmutableHashSetValue, x => ParseableInt(x)) + ); + target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange( + global::System.Linq.Enumerable.Select(source.ImmutableQueueValue, x => ParseableInt(x)) + ); + target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange( + global::System.Linq.Enumerable.Select(source.ImmutableStackValue, x => ParseableInt(x)) + ); + target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet( + global::System.Linq.Enumerable.Select(source.ImmutableSortedSetValue, x => ParseableInt(x)) + ); + target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary( + source.ImmutableDictionaryValue, + x => ParseableInt(x.Key), + x => ParseableInt(x.Value) + ); + target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary( + source.ImmutableSortedDictionaryValue, + x => ParseableInt(x.Key), + x => ParseableInt(x.Value) + ); foreach (var item in source.ExistingISet) { target.ExistingISet.Add(ParseableInt(item)); @@ -378,10 +469,18 @@ public partial void UpdateDto(global::Riok.Mapperly.IntegrationTests.Models.Test { target.ExistingList.Add(ParseableInt(item3)); } - target.ISet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(source.ISet, x => ParseableInt(x))); - target.IReadOnlySet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(source.IReadOnlySet, x => ParseableInt(x))); - target.HashSet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(source.HashSet, x => ParseableInt(x))); - target.SortedSet = new global::System.Collections.Generic.SortedSet(global::System.Linq.Enumerable.Select(source.SortedSet, x => ParseableInt(x))); + target.ISet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(source.ISet, x => ParseableInt(x)) + ); + target.IReadOnlySet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(source.IReadOnlySet, x => ParseableInt(x)) + ); + target.HashSet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(source.HashSet, x => ParseableInt(x)) + ); + target.SortedSet = new global::System.Collections.Generic.SortedSet( + global::System.Linq.Enumerable.Select(source.SortedSet, x => ParseableInt(x)) + ); target.EnumValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue)source.EnumValue; target.FlagsEnumValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestFlagsEnumDto)source.FlagsEnumValue; target.EnumName = MapToEnumDtoByName(source.EnumName); diff --git a/test/Riok.Mapperly.IntegrationTests/_snapshots/ProjectionMapperTest.SnapshotGeneratedSource.verified.cs b/test/Riok.Mapperly.IntegrationTests/_snapshots/ProjectionMapperTest.SnapshotGeneratedSource.verified.cs index c3792bfb24..bb54f8ea90 100644 --- a/test/Riok.Mapperly.IntegrationTests/_snapshots/ProjectionMapperTest.SnapshotGeneratedSource.verified.cs +++ b/test/Riok.Mapperly.IntegrationTests/_snapshots/ProjectionMapperTest.SnapshotGeneratedSource.verified.cs @@ -8,51 +8,65 @@ public static partial class ProjectionMapper public static partial global::System.Linq.IQueryable ProjectToDto(this global::System.Linq.IQueryable q) { #nullable disable - return System.Linq.Queryable.Select(q, x => new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDtoProjection(x.CtorValue) - { - IntValue = x.IntValue, - IntInitOnlyValue = x.IntInitOnlyValue, - RequiredValue = x.RequiredValue, - StringValue = x.StringValue, - RenamedStringValue2 = x.RenamedStringValue, - FlatteningIdValue = x.Flattening.IdValue, - NullableFlatteningIdValue = x.NullableFlattening != null ? x.NullableFlattening.IdValue : default(int?), - NestedNullableIntValue = x.NestedNullable != null ? x.NestedNullable.IntValue : default, - NestedNullable = x.NestedNullable != null ? new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectNestedDto() - { - IntValue = x.NestedNullable.IntValue, - } : default, - NestedNullableTargetNotNullable = x.NestedNullableTargetNotNullable != null ? new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectNestedDto() - { - IntValue = x.NestedNullableTargetNotNullable.IntValue, - } : new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectNestedDto(), - StringNullableTargetNotNullable = x.StringNullableTargetNotNullable ?? "", - SourceTargetSameObjectType = x.SourceTargetSameObjectType, - NullableReadOnlyObjectCollection = x.NullableReadOnlyObjectCollection != null ? global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(x.NullableReadOnlyObjectCollection, x1 => new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectNestedDto() - { - IntValue = x1.IntValue, - })) : default, - EnumValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue)x.EnumValue, - EnumName = (global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByName)x.EnumName, - EnumRawValue = (byte)x.EnumRawValue, - EnumStringValue = (string)x.EnumStringValue.ToString(), - EnumReverseStringValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByName)System.Enum.Parse(typeof(global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByName), x.EnumReverseStringValue, false), - SubObject = x.SubObject != null ? new global::Riok.Mapperly.IntegrationTests.Dto.InheritanceSubObjectDto() - { - SubIntValue = x.SubObject.SubIntValue, - BaseIntValue = x.SubObject.BaseIntValue, - } : default, - DateTimeValueTargetDateOnly = global::System.DateOnly.FromDateTime(x.DateTimeValueTargetDateOnly), - DateTimeValueTargetTimeOnly = global::System.TimeOnly.FromDateTime(x.DateTimeValueTargetTimeOnly), - ManuallyMapped = new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDtoManuallyMappedProjection(100) { StringValue = x.ManuallyMapped }, - ManuallyMappedModified = x.ManuallyMappedModified + 10, - ManuallyMappedList = global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(x.ManuallyMappedList, x1 => x1.Value)), - IntegerValues = global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.OrderBy(x.IntegerValues, x => x.Value)), - DecimalValues = global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(global::System.Linq.Enumerable.OrderBy(x.DecimalValues, x => x.Value), x => new global::Riok.Mapperly.IntegrationTests.Dto.LongValueDto() + return System.Linq.Queryable.Select( + q, + x => new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDtoProjection(x.CtorValue) { - Value = x.Value, - })), - }); + IntValue = x.IntValue, + IntInitOnlyValue = x.IntInitOnlyValue, + RequiredValue = x.RequiredValue, + StringValue = x.StringValue, + RenamedStringValue2 = x.RenamedStringValue, + FlatteningIdValue = x.Flattening.IdValue, + NullableFlatteningIdValue = x.NullableFlattening != null ? x.NullableFlattening.IdValue : default(int?), + NestedNullableIntValue = x.NestedNullable != null ? x.NestedNullable.IntValue : default, + NestedNullable = x.NestedNullable != null ? new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectNestedDto() + { + IntValue = x.NestedNullable.IntValue, + } : default, + NestedNullableTargetNotNullable = x.NestedNullableTargetNotNullable != null ? new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectNestedDto() + { + IntValue = x.NestedNullableTargetNotNullable.IntValue, + } : new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectNestedDto(), + StringNullableTargetNotNullable = x.StringNullableTargetNotNullable ?? "", + SourceTargetSameObjectType = x.SourceTargetSameObjectType, + NullableReadOnlyObjectCollection = x.NullableReadOnlyObjectCollection != null ? global::System.Linq.Enumerable.ToArray( + global::System.Linq.Enumerable.Select( + x.NullableReadOnlyObjectCollection, + x1 => new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectNestedDto() + { + IntValue = x1.IntValue, + } + ) + ) : default, + EnumValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue)x.EnumValue, + EnumName = (global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByName)x.EnumName, + EnumRawValue = (byte)x.EnumRawValue, + EnumStringValue = (string)x.EnumStringValue.ToString(), + EnumReverseStringValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByName)System.Enum.Parse( + typeof(global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByName), + x.EnumReverseStringValue, + false + ), + SubObject = x.SubObject != null ? new global::Riok.Mapperly.IntegrationTests.Dto.InheritanceSubObjectDto() + { + SubIntValue = x.SubObject.SubIntValue, + BaseIntValue = x.SubObject.BaseIntValue, + } : default, + DateTimeValueTargetDateOnly = global::System.DateOnly.FromDateTime(x.DateTimeValueTargetDateOnly), + DateTimeValueTargetTimeOnly = global::System.TimeOnly.FromDateTime(x.DateTimeValueTargetTimeOnly), + ManuallyMapped = new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDtoManuallyMappedProjection(100) { StringValue = x.ManuallyMapped }, + ManuallyMappedModified = x.ManuallyMappedModified + 10, + ManuallyMappedList = global::System.Linq.Enumerable.ToList( + global::System.Linq.Enumerable.Select(x.ManuallyMappedList, x1 => x1.Value) + ), + IntegerValues = global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.OrderBy(x.IntegerValues, x => x.Value)), + DecimalValues = global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(global::System.Linq.Enumerable.OrderBy(x.DecimalValues, x => x.Value), x => new global::Riok.Mapperly.IntegrationTests.Dto.LongValueDto() + { + Value = x.Value, + })), + } + ); #nullable enable } @@ -60,17 +74,20 @@ public static partial class ProjectionMapper public static partial global::System.Linq.IQueryable ProjectToDto(this global::System.Linq.IQueryable q) { #nullable disable - return System.Linq.Queryable.Select(q, x => (global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDtoProjectionBaseType)(x is global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeA ? new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDtoProjectionTypeA() - { - ValueA = ((global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeA)x).ValueA, - Id = ((global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeA)x).Id, - BaseValue = ((global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeA)x).BaseValue, - } : x is global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeB ? new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDtoProjectionTypeB() - { - ValueB = ((global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeB)x).ValueB, - Id = ((global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeB)x).Id, - BaseValue = ((global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeB)x).BaseValue, - } : default)); + return System.Linq.Queryable.Select( + q, + x => (global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDtoProjectionBaseType)(x is global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeA ? new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDtoProjectionTypeA() + { + ValueA = ((global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeA)x).ValueA, + Id = ((global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeA)x).Id, + BaseValue = ((global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeA)x).BaseValue, + } : x is global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeB ? new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDtoProjectionTypeB() + { + ValueB = ((global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeB)x).ValueB, + Id = ((global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeB)x).Id, + BaseValue = ((global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeB)x).BaseValue, + } : default) + ); #nullable enable } @@ -216,7 +233,11 @@ private static string MapToString(global::Riok.Mapperly.IntegrationTests.Models. nameof(global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByName.Value10) => global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByName.Value10, nameof(global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByName.Value20) => global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByName.Value20, nameof(global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByName.Value30) => global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByName.Value30, - _ => (global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByName)System.Enum.Parse(typeof(global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByName), source, false), + _ => (global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByName)System.Enum.Parse( + typeof(global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByName), + source, + false + ), }; } diff --git a/test/Riok.Mapperly.IntegrationTests/_snapshots/ProjectionMapperTest.SnapshotGeneratedSource_NET6_0.verified.cs b/test/Riok.Mapperly.IntegrationTests/_snapshots/ProjectionMapperTest.SnapshotGeneratedSource_NET6_0.verified.cs index ba7014eef4..353667925c 100644 --- a/test/Riok.Mapperly.IntegrationTests/_snapshots/ProjectionMapperTest.SnapshotGeneratedSource_NET6_0.verified.cs +++ b/test/Riok.Mapperly.IntegrationTests/_snapshots/ProjectionMapperTest.SnapshotGeneratedSource_NET6_0.verified.cs @@ -8,51 +8,61 @@ public static partial class ProjectionMapper public static partial global::System.Linq.IQueryable ProjectToDto(this global::System.Linq.IQueryable q) { #nullable disable - return System.Linq.Queryable.Select(q, x => new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDtoProjection(x.CtorValue) - { - IntValue = x.IntValue, - IntInitOnlyValue = x.IntInitOnlyValue, - RequiredValue = x.RequiredValue, - StringValue = x.StringValue, - RenamedStringValue2 = x.RenamedStringValue, - FlatteningIdValue = x.Flattening.IdValue, - NullableFlatteningIdValue = x.NullableFlattening != null ? x.NullableFlattening.IdValue : default(int?), - NestedNullableIntValue = x.NestedNullable != null ? x.NestedNullable.IntValue : default, - NestedNullable = x.NestedNullable != null ? new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectNestedDto() - { - IntValue = x.NestedNullable.IntValue, - } : default, - NestedNullableTargetNotNullable = x.NestedNullableTargetNotNullable != null ? new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectNestedDto() - { - IntValue = x.NestedNullableTargetNotNullable.IntValue, - } : new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectNestedDto(), - StringNullableTargetNotNullable = x.StringNullableTargetNotNullable ?? "", - SourceTargetSameObjectType = x.SourceTargetSameObjectType, - NullableReadOnlyObjectCollection = x.NullableReadOnlyObjectCollection != null ? global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(x.NullableReadOnlyObjectCollection, x1 => new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectNestedDto() - { - IntValue = x1.IntValue, - })) : default, - EnumValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue)x.EnumValue, - EnumName = (global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByName)x.EnumName, - EnumRawValue = (byte)x.EnumRawValue, - EnumStringValue = (string)x.EnumStringValue.ToString(), - EnumReverseStringValue = System.Enum.Parse(x.EnumReverseStringValue, false), - SubObject = x.SubObject != null ? new global::Riok.Mapperly.IntegrationTests.Dto.InheritanceSubObjectDto() - { - SubIntValue = x.SubObject.SubIntValue, - BaseIntValue = x.SubObject.BaseIntValue, - } : default, - DateTimeValueTargetDateOnly = global::System.DateOnly.FromDateTime(x.DateTimeValueTargetDateOnly), - DateTimeValueTargetTimeOnly = global::System.TimeOnly.FromDateTime(x.DateTimeValueTargetTimeOnly), - ManuallyMapped = new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDtoManuallyMappedProjection(100) { StringValue = x.ManuallyMapped }, - ManuallyMappedModified = x.ManuallyMappedModified + 10, - ManuallyMappedList = global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(x.ManuallyMappedList, x1 => x1.Value)), - IntegerValues = global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.OrderBy(x.IntegerValues, x => x.Value)), - DecimalValues = global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(global::System.Linq.Enumerable.OrderBy(x.DecimalValues, x => x.Value), x => new global::Riok.Mapperly.IntegrationTests.Dto.LongValueDto() + return System.Linq.Queryable.Select( + q, + x => new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDtoProjection(x.CtorValue) { - Value = x.Value, - })), - }); + IntValue = x.IntValue, + IntInitOnlyValue = x.IntInitOnlyValue, + RequiredValue = x.RequiredValue, + StringValue = x.StringValue, + RenamedStringValue2 = x.RenamedStringValue, + FlatteningIdValue = x.Flattening.IdValue, + NullableFlatteningIdValue = x.NullableFlattening != null ? x.NullableFlattening.IdValue : default(int?), + NestedNullableIntValue = x.NestedNullable != null ? x.NestedNullable.IntValue : default, + NestedNullable = x.NestedNullable != null ? new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectNestedDto() + { + IntValue = x.NestedNullable.IntValue, + } : default, + NestedNullableTargetNotNullable = x.NestedNullableTargetNotNullable != null ? new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectNestedDto() + { + IntValue = x.NestedNullableTargetNotNullable.IntValue, + } : new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectNestedDto(), + StringNullableTargetNotNullable = x.StringNullableTargetNotNullable ?? "", + SourceTargetSameObjectType = x.SourceTargetSameObjectType, + NullableReadOnlyObjectCollection = x.NullableReadOnlyObjectCollection != null ? global::System.Linq.Enumerable.ToArray( + global::System.Linq.Enumerable.Select( + x.NullableReadOnlyObjectCollection, + x1 => new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectNestedDto() + { + IntValue = x1.IntValue, + } + ) + ) : default, + EnumValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue)x.EnumValue, + EnumName = (global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByName)x.EnumName, + EnumRawValue = (byte)x.EnumRawValue, + EnumStringValue = (string)x.EnumStringValue.ToString(), + EnumReverseStringValue = System.Enum.Parse(x.EnumReverseStringValue, false), + SubObject = x.SubObject != null ? new global::Riok.Mapperly.IntegrationTests.Dto.InheritanceSubObjectDto() + { + SubIntValue = x.SubObject.SubIntValue, + BaseIntValue = x.SubObject.BaseIntValue, + } : default, + DateTimeValueTargetDateOnly = global::System.DateOnly.FromDateTime(x.DateTimeValueTargetDateOnly), + DateTimeValueTargetTimeOnly = global::System.TimeOnly.FromDateTime(x.DateTimeValueTargetTimeOnly), + ManuallyMapped = new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDtoManuallyMappedProjection(100) { StringValue = x.ManuallyMapped }, + ManuallyMappedModified = x.ManuallyMappedModified + 10, + ManuallyMappedList = global::System.Linq.Enumerable.ToList( + global::System.Linq.Enumerable.Select(x.ManuallyMappedList, x1 => x1.Value) + ), + IntegerValues = global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.OrderBy(x.IntegerValues, x => x.Value)), + DecimalValues = global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(global::System.Linq.Enumerable.OrderBy(x.DecimalValues, x => x.Value), x => new global::Riok.Mapperly.IntegrationTests.Dto.LongValueDto() + { + Value = x.Value, + })), + } + ); #nullable enable } @@ -60,17 +70,20 @@ public static partial class ProjectionMapper public static partial global::System.Linq.IQueryable ProjectToDto(this global::System.Linq.IQueryable q) { #nullable disable - return System.Linq.Queryable.Select(q, x => (global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDtoProjectionBaseType)(x is global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeA ? new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDtoProjectionTypeA() - { - ValueA = ((global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeA)x).ValueA, - Id = ((global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeA)x).Id, - BaseValue = ((global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeA)x).BaseValue, - } : x is global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeB ? new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDtoProjectionTypeB() - { - ValueB = ((global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeB)x).ValueB, - Id = ((global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeB)x).Id, - BaseValue = ((global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeB)x).BaseValue, - } : default)); + return System.Linq.Queryable.Select( + q, + x => (global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDtoProjectionBaseType)(x is global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeA ? new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDtoProjectionTypeA() + { + ValueA = ((global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeA)x).ValueA, + Id = ((global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeA)x).Id, + BaseValue = ((global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeA)x).BaseValue, + } : x is global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeB ? new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDtoProjectionTypeB() + { + ValueB = ((global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeB)x).ValueB, + Id = ((global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeB)x).Id, + BaseValue = ((global::Riok.Mapperly.IntegrationTests.Models.TestObjectProjectionTypeB)x).BaseValue, + } : default) + ); #nullable enable } diff --git a/test/Riok.Mapperly.IntegrationTests/_snapshots/StaticMapperTest.SnapshotGeneratedSource.verified.cs b/test/Riok.Mapperly.IntegrationTests/_snapshots/StaticMapperTest.SnapshotGeneratedSource.verified.cs index f288efc9f9..7bbfb34590 100644 --- a/test/Riok.Mapperly.IntegrationTests/_snapshots/StaticMapperTest.SnapshotGeneratedSource.verified.cs +++ b/test/Riok.Mapperly.IntegrationTests/_snapshots/StaticMapperTest.SnapshotGeneratedSource.verified.cs @@ -146,16 +146,40 @@ public static partial void MapIdTargetFirst(global::Riok.Mapperly.IntegrationTes } target.SpanValue = MapToInt32Array1(src.SpanValue); target.MemoryValue = MapToInt32Array2(src.MemoryValue.Span); - target.StackValue = new global::System.Collections.Generic.Stack(global::System.Linq.Enumerable.Select(src.StackValue, x => ParseableInt(x))); - target.QueueValue = new global::System.Collections.Generic.Queue(global::System.Linq.Enumerable.Select(src.QueueValue, x => ParseableInt(x))); - target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray(global::System.Linq.Enumerable.Select(src.ImmutableArrayValue, x => ParseableInt(x))); - target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList(global::System.Linq.Enumerable.Select(src.ImmutableListValue, x => ParseableInt(x))); - target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet(global::System.Linq.Enumerable.Select(src.ImmutableHashSetValue, x => ParseableInt(x))); - target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange(global::System.Linq.Enumerable.Select(src.ImmutableQueueValue, x => ParseableInt(x))); - target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange(global::System.Linq.Enumerable.Select(src.ImmutableStackValue, x => ParseableInt(x))); - target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet(global::System.Linq.Enumerable.Select(src.ImmutableSortedSetValue, x => ParseableInt(x))); - target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary(src.ImmutableDictionaryValue, x => ParseableInt(x.Key), x => ParseableInt(x.Value)); - target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary(src.ImmutableSortedDictionaryValue, x => ParseableInt(x.Key), x => ParseableInt(x.Value)); + target.StackValue = new global::System.Collections.Generic.Stack( + global::System.Linq.Enumerable.Select(src.StackValue, x => ParseableInt(x)) + ); + target.QueueValue = new global::System.Collections.Generic.Queue( + global::System.Linq.Enumerable.Select(src.QueueValue, x => ParseableInt(x)) + ); + target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray( + global::System.Linq.Enumerable.Select(src.ImmutableArrayValue, x => ParseableInt(x)) + ); + target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList( + global::System.Linq.Enumerable.Select(src.ImmutableListValue, x => ParseableInt(x)) + ); + target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet( + global::System.Linq.Enumerable.Select(src.ImmutableHashSetValue, x => ParseableInt(x)) + ); + target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange( + global::System.Linq.Enumerable.Select(src.ImmutableQueueValue, x => ParseableInt(x)) + ); + target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange( + global::System.Linq.Enumerable.Select(src.ImmutableStackValue, x => ParseableInt(x)) + ); + target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet( + global::System.Linq.Enumerable.Select(src.ImmutableSortedSetValue, x => ParseableInt(x)) + ); + target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary( + src.ImmutableDictionaryValue, + x => ParseableInt(x.Key), + x => ParseableInt(x.Value) + ); + target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary( + src.ImmutableSortedDictionaryValue, + x => ParseableInt(x.Key), + x => ParseableInt(x.Value) + ); foreach (var item in src.ExistingISet) { target.ExistingISet.Add(ParseableInt(item)); @@ -170,8 +194,12 @@ public static partial void MapIdTargetFirst(global::Riok.Mapperly.IntegrationTes } MapExistingList(src.ExistingList, target.ExistingList); target.ISet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(src.ISet, x => ParseableInt(x))); - target.HashSet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(src.HashSet, x => ParseableInt(x))); - target.SortedSet = new global::System.Collections.Generic.SortedSet(global::System.Linq.Enumerable.Select(src.SortedSet, x => ParseableInt(x))); + target.HashSet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(src.HashSet, x => ParseableInt(x)) + ); + target.SortedSet = new global::System.Collections.Generic.SortedSet( + global::System.Linq.Enumerable.Select(src.SortedSet, x => ParseableInt(x)) + ); target.EnumValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue)src.EnumValue; target.FlagsEnumValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestFlagsEnumDto)src.FlagsEnumValue; target.EnumName = MapToEnumDtoByName(src.EnumName); @@ -194,7 +222,10 @@ public static partial void MapIdTargetFirst(global::Riok.Mapperly.IntegrationTes [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] private static partial global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDto MapToDtoInternal(global::Riok.Mapperly.IntegrationTests.Models.TestObject testObject) { - var target = new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDto(DirectInt(testObject.CtorValue), ctorValue2: DirectInt(testObject.CtorValue2)) + var target = new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDto( + DirectInt(testObject.CtorValue), + ctorValue2: DirectInt(testObject.CtorValue2) + ) { IntInitOnlyValue = DirectInt(testObject.IntInitOnlyValue), RequiredValue = DirectInt(testObject.RequiredValue), @@ -261,16 +292,40 @@ public static partial void MapIdTargetFirst(global::Riok.Mapperly.IntegrationTes } target.SpanValue = MapToInt32Array1(testObject.SpanValue); target.MemoryValue = MapToInt32Array2(testObject.MemoryValue.Span); - target.StackValue = new global::System.Collections.Generic.Stack(global::System.Linq.Enumerable.Select(testObject.StackValue, x => ParseableInt(x))); - target.QueueValue = new global::System.Collections.Generic.Queue(global::System.Linq.Enumerable.Select(testObject.QueueValue, x => ParseableInt(x))); - target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray(global::System.Linq.Enumerable.Select(testObject.ImmutableArrayValue, x => ParseableInt(x))); - target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList(global::System.Linq.Enumerable.Select(testObject.ImmutableListValue, x => ParseableInt(x))); - target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet(global::System.Linq.Enumerable.Select(testObject.ImmutableHashSetValue, x => ParseableInt(x))); - target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange(global::System.Linq.Enumerable.Select(testObject.ImmutableQueueValue, x => ParseableInt(x))); - target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange(global::System.Linq.Enumerable.Select(testObject.ImmutableStackValue, x => ParseableInt(x))); - target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet(global::System.Linq.Enumerable.Select(testObject.ImmutableSortedSetValue, x => ParseableInt(x))); - target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary(testObject.ImmutableDictionaryValue, x => ParseableInt(x.Key), x => ParseableInt(x.Value)); - target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary(testObject.ImmutableSortedDictionaryValue, x => ParseableInt(x.Key), x => ParseableInt(x.Value)); + target.StackValue = new global::System.Collections.Generic.Stack( + global::System.Linq.Enumerable.Select(testObject.StackValue, x => ParseableInt(x)) + ); + target.QueueValue = new global::System.Collections.Generic.Queue( + global::System.Linq.Enumerable.Select(testObject.QueueValue, x => ParseableInt(x)) + ); + target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray( + global::System.Linq.Enumerable.Select(testObject.ImmutableArrayValue, x => ParseableInt(x)) + ); + target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList( + global::System.Linq.Enumerable.Select(testObject.ImmutableListValue, x => ParseableInt(x)) + ); + target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet( + global::System.Linq.Enumerable.Select(testObject.ImmutableHashSetValue, x => ParseableInt(x)) + ); + target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange( + global::System.Linq.Enumerable.Select(testObject.ImmutableQueueValue, x => ParseableInt(x)) + ); + target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange( + global::System.Linq.Enumerable.Select(testObject.ImmutableStackValue, x => ParseableInt(x)) + ); + target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet( + global::System.Linq.Enumerable.Select(testObject.ImmutableSortedSetValue, x => ParseableInt(x)) + ); + target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary( + testObject.ImmutableDictionaryValue, + x => ParseableInt(x.Key), + x => ParseableInt(x.Value) + ); + target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary( + testObject.ImmutableSortedDictionaryValue, + x => ParseableInt(x.Key), + x => ParseableInt(x.Value) + ); foreach (var item in testObject.ExistingISet) { target.ExistingISet.Add(ParseableInt(item)); @@ -284,9 +339,15 @@ public static partial void MapIdTargetFirst(global::Riok.Mapperly.IntegrationTes target.ExistingSortedSet.Add(ParseableInt(item2)); } MapExistingList(testObject.ExistingList, target.ExistingList); - target.ISet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(testObject.ISet, x => ParseableInt(x))); - target.HashSet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(testObject.HashSet, x => ParseableInt(x))); - target.SortedSet = new global::System.Collections.Generic.SortedSet(global::System.Linq.Enumerable.Select(testObject.SortedSet, x => ParseableInt(x))); + target.ISet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(testObject.ISet, x => ParseableInt(x)) + ); + target.HashSet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(testObject.HashSet, x => ParseableInt(x)) + ); + target.SortedSet = new global::System.Collections.Generic.SortedSet( + global::System.Linq.Enumerable.Select(testObject.SortedSet, x => ParseableInt(x)) + ); target.EnumValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue)testObject.EnumValue; target.FlagsEnumValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestFlagsEnumDto)testObject.FlagsEnumValue; target.EnumName = MapToEnumDtoByName(testObject.EnumName); @@ -361,16 +422,40 @@ public static partial void MapIdTargetFirst(global::Riok.Mapperly.IntegrationTes target.NullableReadOnlyObjectCollection = null; } target.MemoryValue = MapToStringArray(dto.MemoryValue.Span); - target.StackValue = new global::System.Collections.Generic.Stack(global::System.Linq.Enumerable.Select(dto.StackValue, x => x.ToString())); - target.QueueValue = new global::System.Collections.Generic.Queue(global::System.Linq.Enumerable.Select(dto.QueueValue, x => x.ToString())); - target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray(global::System.Linq.Enumerable.Select(dto.ImmutableArrayValue, x => x.ToString())); - target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList(global::System.Linq.Enumerable.Select(dto.ImmutableListValue, x => x.ToString())); - target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet(global::System.Linq.Enumerable.Select(dto.ImmutableHashSetValue, x => x.ToString())); - target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange(global::System.Linq.Enumerable.Select(dto.ImmutableQueueValue, x => x.ToString())); - target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange(global::System.Linq.Enumerable.Select(dto.ImmutableStackValue, x => x.ToString())); - target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet(global::System.Linq.Enumerable.Select(dto.ImmutableSortedSetValue, x => x.ToString())); - target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary(dto.ImmutableDictionaryValue, x => x.Key.ToString(), x => x.Value.ToString()); - target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary(dto.ImmutableSortedDictionaryValue, x => x.Key.ToString(), x => x.Value.ToString()); + target.StackValue = new global::System.Collections.Generic.Stack( + global::System.Linq.Enumerable.Select(dto.StackValue, x => x.ToString()) + ); + target.QueueValue = new global::System.Collections.Generic.Queue( + global::System.Linq.Enumerable.Select(dto.QueueValue, x => x.ToString()) + ); + target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray( + global::System.Linq.Enumerable.Select(dto.ImmutableArrayValue, x => x.ToString()) + ); + target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList( + global::System.Linq.Enumerable.Select(dto.ImmutableListValue, x => x.ToString()) + ); + target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet( + global::System.Linq.Enumerable.Select(dto.ImmutableHashSetValue, x => x.ToString()) + ); + target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange( + global::System.Linq.Enumerable.Select(dto.ImmutableQueueValue, x => x.ToString()) + ); + target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange( + global::System.Linq.Enumerable.Select(dto.ImmutableStackValue, x => x.ToString()) + ); + target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet( + global::System.Linq.Enumerable.Select(dto.ImmutableSortedSetValue, x => x.ToString()) + ); + target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary( + dto.ImmutableDictionaryValue, + x => x.Key.ToString(), + x => x.Value.ToString() + ); + target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary( + dto.ImmutableSortedDictionaryValue, + x => x.Key.ToString(), + x => x.Value.ToString() + ); foreach (var item in dto.ExistingISet) { target.ExistingISet.Add(item.ToString()); @@ -389,7 +474,9 @@ public static partial void MapIdTargetFirst(global::Riok.Mapperly.IntegrationTes } target.ISet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(dto.ISet, x => x.ToString())); target.HashSet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(dto.HashSet, x => x.ToString())); - target.SortedSet = new global::System.Collections.Generic.SortedSet(global::System.Linq.Enumerable.Select(dto.SortedSet, x => x.ToString())); + target.SortedSet = new global::System.Collections.Generic.SortedSet( + global::System.Linq.Enumerable.Select(dto.SortedSet, x => x.ToString()) + ); target.EnumValue = MapToEnumByValueCheckDefined(dto.EnumValue); target.FlagsEnumValue = MapToFlagsEnumByValueCheckDefined(dto.FlagsEnumValue); target.EnumName = MapToEnumByNameWithFallback(dto.EnumName); @@ -467,16 +554,40 @@ public static partial void UpdateDto(global::Riok.Mapperly.IntegrationTests.Mode } target.SpanValue = MapToInt32Array1(source.SpanValue); target.MemoryValue = MapToInt32Array2(source.MemoryValue.Span); - target.StackValue = new global::System.Collections.Generic.Stack(global::System.Linq.Enumerable.Select(source.StackValue, x => ParseableInt(x))); - target.QueueValue = new global::System.Collections.Generic.Queue(global::System.Linq.Enumerable.Select(source.QueueValue, x => ParseableInt(x))); - target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray(global::System.Linq.Enumerable.Select(source.ImmutableArrayValue, x => ParseableInt(x))); - target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList(global::System.Linq.Enumerable.Select(source.ImmutableListValue, x => ParseableInt(x))); - target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet(global::System.Linq.Enumerable.Select(source.ImmutableHashSetValue, x => ParseableInt(x))); - target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange(global::System.Linq.Enumerable.Select(source.ImmutableQueueValue, x => ParseableInt(x))); - target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange(global::System.Linq.Enumerable.Select(source.ImmutableStackValue, x => ParseableInt(x))); - target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet(global::System.Linq.Enumerable.Select(source.ImmutableSortedSetValue, x => ParseableInt(x))); - target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary(source.ImmutableDictionaryValue, x => ParseableInt(x.Key), x => ParseableInt(x.Value)); - target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary(source.ImmutableSortedDictionaryValue, x => ParseableInt(x.Key), x => ParseableInt(x.Value)); + target.StackValue = new global::System.Collections.Generic.Stack( + global::System.Linq.Enumerable.Select(source.StackValue, x => ParseableInt(x)) + ); + target.QueueValue = new global::System.Collections.Generic.Queue( + global::System.Linq.Enumerable.Select(source.QueueValue, x => ParseableInt(x)) + ); + target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray( + global::System.Linq.Enumerable.Select(source.ImmutableArrayValue, x => ParseableInt(x)) + ); + target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList( + global::System.Linq.Enumerable.Select(source.ImmutableListValue, x => ParseableInt(x)) + ); + target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet( + global::System.Linq.Enumerable.Select(source.ImmutableHashSetValue, x => ParseableInt(x)) + ); + target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange( + global::System.Linq.Enumerable.Select(source.ImmutableQueueValue, x => ParseableInt(x)) + ); + target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange( + global::System.Linq.Enumerable.Select(source.ImmutableStackValue, x => ParseableInt(x)) + ); + target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet( + global::System.Linq.Enumerable.Select(source.ImmutableSortedSetValue, x => ParseableInt(x)) + ); + target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary( + source.ImmutableDictionaryValue, + x => ParseableInt(x.Key), + x => ParseableInt(x.Value) + ); + target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary( + source.ImmutableSortedDictionaryValue, + x => ParseableInt(x.Key), + x => ParseableInt(x.Value) + ); foreach (var item in source.ExistingISet) { target.ExistingISet.Add(ParseableInt(item)); @@ -490,9 +601,15 @@ public static partial void UpdateDto(global::Riok.Mapperly.IntegrationTests.Mode target.ExistingSortedSet.Add(ParseableInt(item2)); } MapExistingList(source.ExistingList, target.ExistingList); - target.ISet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(source.ISet, x => ParseableInt(x))); - target.HashSet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(source.HashSet, x => ParseableInt(x))); - target.SortedSet = new global::System.Collections.Generic.SortedSet(global::System.Linq.Enumerable.Select(source.SortedSet, x => ParseableInt(x))); + target.ISet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(source.ISet, x => ParseableInt(x)) + ); + target.HashSet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(source.HashSet, x => ParseableInt(x)) + ); + target.SortedSet = new global::System.Collections.Generic.SortedSet( + global::System.Linq.Enumerable.Select(source.SortedSet, x => ParseableInt(x)) + ); target.EnumValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue)source.EnumValue; target.FlagsEnumValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestFlagsEnumDto)source.FlagsEnumValue; target.EnumName = MapToEnumDtoByName(source.EnumName); @@ -819,7 +936,11 @@ private static string MapToString(global::Riok.Mapperly.IntegrationTests.Models. nameof(global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue.DtoValue1) => global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue.DtoValue1, nameof(global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue.DtoValue2) => global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue.DtoValue2, nameof(global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue.DtoValue3) => global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue.DtoValue3, - _ => (global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue)System.Enum.Parse(typeof(global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue), source, false), + _ => (global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue)System.Enum.Parse( + typeof(global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue), + source, + false + ), }; } @@ -877,7 +998,11 @@ private static string[] MapToStringArray(global::System.ReadOnlySpan source nameof(global::Riok.Mapperly.IntegrationTests.Models.TestEnum.Value10) => global::Riok.Mapperly.IntegrationTests.Models.TestEnum.Value10, nameof(global::Riok.Mapperly.IntegrationTests.Models.TestEnum.Value20) => global::Riok.Mapperly.IntegrationTests.Models.TestEnum.Value20, nameof(global::Riok.Mapperly.IntegrationTests.Models.TestEnum.Value30) => global::Riok.Mapperly.IntegrationTests.Models.TestEnum.Value30, - _ => (global::Riok.Mapperly.IntegrationTests.Models.TestEnum)System.Enum.Parse(typeof(global::Riok.Mapperly.IntegrationTests.Models.TestEnum), source, false), + _ => (global::Riok.Mapperly.IntegrationTests.Models.TestEnum)System.Enum.Parse( + typeof(global::Riok.Mapperly.IntegrationTests.Models.TestEnum), + source, + false + ), }; } diff --git a/test/Riok.Mapperly.IntegrationTests/_snapshots/StaticMapperTest.SnapshotGeneratedSource_NET6_0.verified.cs b/test/Riok.Mapperly.IntegrationTests/_snapshots/StaticMapperTest.SnapshotGeneratedSource_NET6_0.verified.cs index 93455f63b9..e923b69b17 100644 --- a/test/Riok.Mapperly.IntegrationTests/_snapshots/StaticMapperTest.SnapshotGeneratedSource_NET6_0.verified.cs +++ b/test/Riok.Mapperly.IntegrationTests/_snapshots/StaticMapperTest.SnapshotGeneratedSource_NET6_0.verified.cs @@ -146,16 +146,40 @@ public static partial void MapIdTargetFirst(global::Riok.Mapperly.IntegrationTes } target.SpanValue = MapToInt32Array1(src.SpanValue); target.MemoryValue = MapToInt32Array2(src.MemoryValue.Span); - target.StackValue = new global::System.Collections.Generic.Stack(global::System.Linq.Enumerable.Select(src.StackValue, x => ParseableInt(x))); - target.QueueValue = new global::System.Collections.Generic.Queue(global::System.Linq.Enumerable.Select(src.QueueValue, x => ParseableInt(x))); - target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray(global::System.Linq.Enumerable.Select(src.ImmutableArrayValue, x => ParseableInt(x))); - target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList(global::System.Linq.Enumerable.Select(src.ImmutableListValue, x => ParseableInt(x))); - target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet(global::System.Linq.Enumerable.Select(src.ImmutableHashSetValue, x => ParseableInt(x))); - target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange(global::System.Linq.Enumerable.Select(src.ImmutableQueueValue, x => ParseableInt(x))); - target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange(global::System.Linq.Enumerable.Select(src.ImmutableStackValue, x => ParseableInt(x))); - target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet(global::System.Linq.Enumerable.Select(src.ImmutableSortedSetValue, x => ParseableInt(x))); - target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary(src.ImmutableDictionaryValue, x => ParseableInt(x.Key), x => ParseableInt(x.Value)); - target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary(src.ImmutableSortedDictionaryValue, x => ParseableInt(x.Key), x => ParseableInt(x.Value)); + target.StackValue = new global::System.Collections.Generic.Stack( + global::System.Linq.Enumerable.Select(src.StackValue, x => ParseableInt(x)) + ); + target.QueueValue = new global::System.Collections.Generic.Queue( + global::System.Linq.Enumerable.Select(src.QueueValue, x => ParseableInt(x)) + ); + target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray( + global::System.Linq.Enumerable.Select(src.ImmutableArrayValue, x => ParseableInt(x)) + ); + target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList( + global::System.Linq.Enumerable.Select(src.ImmutableListValue, x => ParseableInt(x)) + ); + target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet( + global::System.Linq.Enumerable.Select(src.ImmutableHashSetValue, x => ParseableInt(x)) + ); + target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange( + global::System.Linq.Enumerable.Select(src.ImmutableQueueValue, x => ParseableInt(x)) + ); + target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange( + global::System.Linq.Enumerable.Select(src.ImmutableStackValue, x => ParseableInt(x)) + ); + target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet( + global::System.Linq.Enumerable.Select(src.ImmutableSortedSetValue, x => ParseableInt(x)) + ); + target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary( + src.ImmutableDictionaryValue, + x => ParseableInt(x.Key), + x => ParseableInt(x.Value) + ); + target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary( + src.ImmutableSortedDictionaryValue, + x => ParseableInt(x.Key), + x => ParseableInt(x.Value) + ); foreach (var item in src.ExistingISet) { target.ExistingISet.Add(ParseableInt(item)); @@ -171,9 +195,15 @@ public static partial void MapIdTargetFirst(global::Riok.Mapperly.IntegrationTes } MapExistingList(src.ExistingList, target.ExistingList); target.ISet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(src.ISet, x => ParseableInt(x))); - target.IReadOnlySet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(src.IReadOnlySet, x => ParseableInt(x))); - target.HashSet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(src.HashSet, x => ParseableInt(x))); - target.SortedSet = new global::System.Collections.Generic.SortedSet(global::System.Linq.Enumerable.Select(src.SortedSet, x => ParseableInt(x))); + target.IReadOnlySet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(src.IReadOnlySet, x => ParseableInt(x)) + ); + target.HashSet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(src.HashSet, x => ParseableInt(x)) + ); + target.SortedSet = new global::System.Collections.Generic.SortedSet( + global::System.Linq.Enumerable.Select(src.SortedSet, x => ParseableInt(x)) + ); target.EnumValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue)src.EnumValue; target.FlagsEnumValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestFlagsEnumDto)src.FlagsEnumValue; target.EnumName = MapToEnumDtoByName(src.EnumName); @@ -196,7 +226,10 @@ public static partial void MapIdTargetFirst(global::Riok.Mapperly.IntegrationTes [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] private static partial global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDto MapToDtoInternal(global::Riok.Mapperly.IntegrationTests.Models.TestObject testObject) { - var target = new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDto(DirectInt(testObject.CtorValue), ctorValue2: DirectInt(testObject.CtorValue2)) + var target = new global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDto( + DirectInt(testObject.CtorValue), + ctorValue2: DirectInt(testObject.CtorValue2) + ) { IntInitOnlyValue = DirectInt(testObject.IntInitOnlyValue), RequiredValue = DirectInt(testObject.RequiredValue), @@ -263,16 +296,40 @@ public static partial void MapIdTargetFirst(global::Riok.Mapperly.IntegrationTes } target.SpanValue = MapToInt32Array1(testObject.SpanValue); target.MemoryValue = MapToInt32Array2(testObject.MemoryValue.Span); - target.StackValue = new global::System.Collections.Generic.Stack(global::System.Linq.Enumerable.Select(testObject.StackValue, x => ParseableInt(x))); - target.QueueValue = new global::System.Collections.Generic.Queue(global::System.Linq.Enumerable.Select(testObject.QueueValue, x => ParseableInt(x))); - target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray(global::System.Linq.Enumerable.Select(testObject.ImmutableArrayValue, x => ParseableInt(x))); - target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList(global::System.Linq.Enumerable.Select(testObject.ImmutableListValue, x => ParseableInt(x))); - target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet(global::System.Linq.Enumerable.Select(testObject.ImmutableHashSetValue, x => ParseableInt(x))); - target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange(global::System.Linq.Enumerable.Select(testObject.ImmutableQueueValue, x => ParseableInt(x))); - target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange(global::System.Linq.Enumerable.Select(testObject.ImmutableStackValue, x => ParseableInt(x))); - target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet(global::System.Linq.Enumerable.Select(testObject.ImmutableSortedSetValue, x => ParseableInt(x))); - target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary(testObject.ImmutableDictionaryValue, x => ParseableInt(x.Key), x => ParseableInt(x.Value)); - target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary(testObject.ImmutableSortedDictionaryValue, x => ParseableInt(x.Key), x => ParseableInt(x.Value)); + target.StackValue = new global::System.Collections.Generic.Stack( + global::System.Linq.Enumerable.Select(testObject.StackValue, x => ParseableInt(x)) + ); + target.QueueValue = new global::System.Collections.Generic.Queue( + global::System.Linq.Enumerable.Select(testObject.QueueValue, x => ParseableInt(x)) + ); + target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray( + global::System.Linq.Enumerable.Select(testObject.ImmutableArrayValue, x => ParseableInt(x)) + ); + target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList( + global::System.Linq.Enumerable.Select(testObject.ImmutableListValue, x => ParseableInt(x)) + ); + target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet( + global::System.Linq.Enumerable.Select(testObject.ImmutableHashSetValue, x => ParseableInt(x)) + ); + target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange( + global::System.Linq.Enumerable.Select(testObject.ImmutableQueueValue, x => ParseableInt(x)) + ); + target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange( + global::System.Linq.Enumerable.Select(testObject.ImmutableStackValue, x => ParseableInt(x)) + ); + target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet( + global::System.Linq.Enumerable.Select(testObject.ImmutableSortedSetValue, x => ParseableInt(x)) + ); + target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary( + testObject.ImmutableDictionaryValue, + x => ParseableInt(x.Key), + x => ParseableInt(x.Value) + ); + target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary( + testObject.ImmutableSortedDictionaryValue, + x => ParseableInt(x.Key), + x => ParseableInt(x.Value) + ); foreach (var item in testObject.ExistingISet) { target.ExistingISet.Add(ParseableInt(item)); @@ -287,10 +344,18 @@ public static partial void MapIdTargetFirst(global::Riok.Mapperly.IntegrationTes target.ExistingSortedSet.Add(ParseableInt(item2)); } MapExistingList(testObject.ExistingList, target.ExistingList); - target.ISet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(testObject.ISet, x => ParseableInt(x))); - target.IReadOnlySet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(testObject.IReadOnlySet, x => ParseableInt(x))); - target.HashSet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(testObject.HashSet, x => ParseableInt(x))); - target.SortedSet = new global::System.Collections.Generic.SortedSet(global::System.Linq.Enumerable.Select(testObject.SortedSet, x => ParseableInt(x))); + target.ISet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(testObject.ISet, x => ParseableInt(x)) + ); + target.IReadOnlySet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(testObject.IReadOnlySet, x => ParseableInt(x)) + ); + target.HashSet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(testObject.HashSet, x => ParseableInt(x)) + ); + target.SortedSet = new global::System.Collections.Generic.SortedSet( + global::System.Linq.Enumerable.Select(testObject.SortedSet, x => ParseableInt(x)) + ); target.EnumValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue)testObject.EnumValue; target.FlagsEnumValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestFlagsEnumDto)testObject.FlagsEnumValue; target.EnumName = MapToEnumDtoByName(testObject.EnumName); @@ -365,16 +430,40 @@ public static partial void MapIdTargetFirst(global::Riok.Mapperly.IntegrationTes target.NullableReadOnlyObjectCollection = null; } target.MemoryValue = MapToStringArray(dto.MemoryValue.Span); - target.StackValue = new global::System.Collections.Generic.Stack(global::System.Linq.Enumerable.Select(dto.StackValue, x => x.ToString())); - target.QueueValue = new global::System.Collections.Generic.Queue(global::System.Linq.Enumerable.Select(dto.QueueValue, x => x.ToString())); - target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray(global::System.Linq.Enumerable.Select(dto.ImmutableArrayValue, x => x.ToString())); - target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList(global::System.Linq.Enumerable.Select(dto.ImmutableListValue, x => x.ToString())); - target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet(global::System.Linq.Enumerable.Select(dto.ImmutableHashSetValue, x => x.ToString())); - target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange(global::System.Linq.Enumerable.Select(dto.ImmutableQueueValue, x => x.ToString())); - target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange(global::System.Linq.Enumerable.Select(dto.ImmutableStackValue, x => x.ToString())); - target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet(global::System.Linq.Enumerable.Select(dto.ImmutableSortedSetValue, x => x.ToString())); - target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary(dto.ImmutableDictionaryValue, x => x.Key.ToString(), x => x.Value.ToString()); - target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary(dto.ImmutableSortedDictionaryValue, x => x.Key.ToString(), x => x.Value.ToString()); + target.StackValue = new global::System.Collections.Generic.Stack( + global::System.Linq.Enumerable.Select(dto.StackValue, x => x.ToString()) + ); + target.QueueValue = new global::System.Collections.Generic.Queue( + global::System.Linq.Enumerable.Select(dto.QueueValue, x => x.ToString()) + ); + target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray( + global::System.Linq.Enumerable.Select(dto.ImmutableArrayValue, x => x.ToString()) + ); + target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList( + global::System.Linq.Enumerable.Select(dto.ImmutableListValue, x => x.ToString()) + ); + target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet( + global::System.Linq.Enumerable.Select(dto.ImmutableHashSetValue, x => x.ToString()) + ); + target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange( + global::System.Linq.Enumerable.Select(dto.ImmutableQueueValue, x => x.ToString()) + ); + target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange( + global::System.Linq.Enumerable.Select(dto.ImmutableStackValue, x => x.ToString()) + ); + target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet( + global::System.Linq.Enumerable.Select(dto.ImmutableSortedSetValue, x => x.ToString()) + ); + target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary( + dto.ImmutableDictionaryValue, + x => x.Key.ToString(), + x => x.Value.ToString() + ); + target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary( + dto.ImmutableSortedDictionaryValue, + x => x.Key.ToString(), + x => x.Value.ToString() + ); foreach (var item in dto.ExistingISet) { target.ExistingISet.Add(item.ToString()); @@ -394,9 +483,13 @@ public static partial void MapIdTargetFirst(global::Riok.Mapperly.IntegrationTes target.ExistingList.Add(item3.ToString()); } target.ISet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(dto.ISet, x => x.ToString())); - target.IReadOnlySet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(dto.IReadOnlySet, x => x.ToString())); + target.IReadOnlySet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(dto.IReadOnlySet, x => x.ToString()) + ); target.HashSet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(dto.HashSet, x => x.ToString())); - target.SortedSet = new global::System.Collections.Generic.SortedSet(global::System.Linq.Enumerable.Select(dto.SortedSet, x => x.ToString())); + target.SortedSet = new global::System.Collections.Generic.SortedSet( + global::System.Linq.Enumerable.Select(dto.SortedSet, x => x.ToString()) + ); target.EnumValue = MapToEnumByValueCheckDefined(dto.EnumValue); target.FlagsEnumValue = MapToFlagsEnumByValueCheckDefined(dto.FlagsEnumValue); target.EnumName = MapToEnumByNameWithFallback(dto.EnumName); @@ -474,16 +567,40 @@ public static partial void UpdateDto(global::Riok.Mapperly.IntegrationTests.Mode } target.SpanValue = MapToInt32Array1(source.SpanValue); target.MemoryValue = MapToInt32Array2(source.MemoryValue.Span); - target.StackValue = new global::System.Collections.Generic.Stack(global::System.Linq.Enumerable.Select(source.StackValue, x => ParseableInt(x))); - target.QueueValue = new global::System.Collections.Generic.Queue(global::System.Linq.Enumerable.Select(source.QueueValue, x => ParseableInt(x))); - target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray(global::System.Linq.Enumerable.Select(source.ImmutableArrayValue, x => ParseableInt(x))); - target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList(global::System.Linq.Enumerable.Select(source.ImmutableListValue, x => ParseableInt(x))); - target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet(global::System.Linq.Enumerable.Select(source.ImmutableHashSetValue, x => ParseableInt(x))); - target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange(global::System.Linq.Enumerable.Select(source.ImmutableQueueValue, x => ParseableInt(x))); - target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange(global::System.Linq.Enumerable.Select(source.ImmutableStackValue, x => ParseableInt(x))); - target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet(global::System.Linq.Enumerable.Select(source.ImmutableSortedSetValue, x => ParseableInt(x))); - target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary(source.ImmutableDictionaryValue, x => ParseableInt(x.Key), x => ParseableInt(x.Value)); - target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary(source.ImmutableSortedDictionaryValue, x => ParseableInt(x.Key), x => ParseableInt(x.Value)); + target.StackValue = new global::System.Collections.Generic.Stack( + global::System.Linq.Enumerable.Select(source.StackValue, x => ParseableInt(x)) + ); + target.QueueValue = new global::System.Collections.Generic.Queue( + global::System.Linq.Enumerable.Select(source.QueueValue, x => ParseableInt(x)) + ); + target.ImmutableArrayValue = global::System.Collections.Immutable.ImmutableArray.ToImmutableArray( + global::System.Linq.Enumerable.Select(source.ImmutableArrayValue, x => ParseableInt(x)) + ); + target.ImmutableListValue = global::System.Collections.Immutable.ImmutableList.ToImmutableList( + global::System.Linq.Enumerable.Select(source.ImmutableListValue, x => ParseableInt(x)) + ); + target.ImmutableHashSetValue = global::System.Collections.Immutable.ImmutableHashSet.ToImmutableHashSet( + global::System.Linq.Enumerable.Select(source.ImmutableHashSetValue, x => ParseableInt(x)) + ); + target.ImmutableQueueValue = global::System.Collections.Immutable.ImmutableQueue.CreateRange( + global::System.Linq.Enumerable.Select(source.ImmutableQueueValue, x => ParseableInt(x)) + ); + target.ImmutableStackValue = global::System.Collections.Immutable.ImmutableStack.CreateRange( + global::System.Linq.Enumerable.Select(source.ImmutableStackValue, x => ParseableInt(x)) + ); + target.ImmutableSortedSetValue = global::System.Collections.Immutable.ImmutableSortedSet.ToImmutableSortedSet( + global::System.Linq.Enumerable.Select(source.ImmutableSortedSetValue, x => ParseableInt(x)) + ); + target.ImmutableDictionaryValue = global::System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary( + source.ImmutableDictionaryValue, + x => ParseableInt(x.Key), + x => ParseableInt(x.Value) + ); + target.ImmutableSortedDictionaryValue = global::System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary( + source.ImmutableSortedDictionaryValue, + x => ParseableInt(x.Key), + x => ParseableInt(x.Value) + ); foreach (var item in source.ExistingISet) { target.ExistingISet.Add(ParseableInt(item)); @@ -498,10 +615,18 @@ public static partial void UpdateDto(global::Riok.Mapperly.IntegrationTests.Mode target.ExistingSortedSet.Add(ParseableInt(item2)); } MapExistingList(source.ExistingList, target.ExistingList); - target.ISet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(source.ISet, x => ParseableInt(x))); - target.IReadOnlySet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(source.IReadOnlySet, x => ParseableInt(x))); - target.HashSet = global::System.Linq.Enumerable.ToHashSet(global::System.Linq.Enumerable.Select(source.HashSet, x => ParseableInt(x))); - target.SortedSet = new global::System.Collections.Generic.SortedSet(global::System.Linq.Enumerable.Select(source.SortedSet, x => ParseableInt(x))); + target.ISet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(source.ISet, x => ParseableInt(x)) + ); + target.IReadOnlySet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(source.IReadOnlySet, x => ParseableInt(x)) + ); + target.HashSet = global::System.Linq.Enumerable.ToHashSet( + global::System.Linq.Enumerable.Select(source.HashSet, x => ParseableInt(x)) + ); + target.SortedSet = new global::System.Collections.Generic.SortedSet( + global::System.Linq.Enumerable.Select(source.SortedSet, x => ParseableInt(x)) + ); target.EnumValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByValue)source.EnumValue; target.FlagsEnumValue = (global::Riok.Mapperly.IntegrationTests.Dto.TestFlagsEnumDto)source.FlagsEnumValue; target.EnumName = MapToEnumDtoByName(source.EnumName); diff --git a/test/Riok.Mapperly.Tests/Mapping/DictionaryTest.cs b/test/Riok.Mapperly.Tests/Mapping/DictionaryTest.cs index 40fd1d2be2..bccfcd8881 100644 --- a/test/Riok.Mapperly.Tests/Mapping/DictionaryTest.cs +++ b/test/Riok.Mapperly.Tests/Mapping/DictionaryTest.cs @@ -408,7 +408,11 @@ public void DictionaryMappingDisabledShouldUseEnumerableMapping() .Should() .HaveAssertedAllDiagnostics() .HaveMapMethodBody( - "return new global::System.Collections.Generic.Dictionary(global::System.Linq.Enumerable.Select(source, x => MapToKeyValuePairOfInt32AndInt32(x)));" + """ + return new global::System.Collections.Generic.Dictionary( + global::System.Linq.Enumerable.Select(source, x => MapToKeyValuePairOfInt32AndInt32(x)) + ); + """ ); } diff --git a/test/Riok.Mapperly.Tests/Mapping/ObjectPropertyConstructorResolverTest.cs b/test/Riok.Mapperly.Tests/Mapping/ObjectPropertyConstructorResolverTest.cs index e8c26ed6c4..9e60cdae9a 100644 --- a/test/Riok.Mapperly.Tests/Mapping/ObjectPropertyConstructorResolverTest.cs +++ b/test/Riok.Mapperly.Tests/Mapping/ObjectPropertyConstructorResolverTest.cs @@ -349,7 +349,9 @@ public void RecordToFlattenedRecordNullablePath() .Should() .HaveSingleMethodBody( """ - var target = new global::B(source.Nested?.Value ?? throw new System.ArgumentNullException(nameof(source.Nested.Value))); + var target = new global::B( + source.Nested?.Value ?? throw new System.ArgumentNullException(nameof(source.Nested.Value)) + ); return target; """ ); @@ -428,7 +430,9 @@ public void RecordToRecordNullableToNonNullablePrimitive() .Should() .HaveSingleMethodBody( """ - var target = new global::B(source.Value ?? throw new System.ArgumentNullException(nameof(source.Value))); + var target = new global::B( + source.Value ?? throw new System.ArgumentNullException(nameof(source.Value)) + ); return target; """ ); @@ -444,7 +448,9 @@ public void RecordToRecordNonDirectAssignmentNullHandling() .Should() .HaveSingleMethodBody( """ - var target = new global::B(source.Value != null ? (double)source.Value.Value : throw new System.ArgumentNullException(nameof(source.Value.Value))); + var target = new global::B( + source.Value != null ? (double)source.Value.Value : throw new System.ArgumentNullException(nameof(source.Value.Value)) + ); return target; """ ); @@ -460,7 +466,9 @@ public void RecordToRecordFlattenedNonDirectAssignmentNullHandling() .Should() .HaveSingleMethodBody( """ - var target = new global::B(source.Nested != null ? (double)source.Nested.Value : throw new System.ArgumentNullException(nameof(source.Nested.Value))); + var target = new global::B( + source.Nested != null ? (double)source.Nested.Value : throw new System.ArgumentNullException(nameof(source.Nested.Value)) + ); return target; """ ); @@ -544,7 +552,9 @@ public void RecordToRecordNullableToNullableEnum() .Should() .HaveMapMethodBody( """ - var target = new global::B(source.EnumValue != null ? (global::D)source.EnumValue.Value : default(global::D?)); + var target = new global::B( + source.EnumValue != null ? (global::D)source.EnumValue.Value : default(global::D?) + ); return target; """ ); @@ -567,7 +577,9 @@ public void RecordToRecordNullableToNullableStruct() .Should() .HaveMapMethodBody( """ - var target = new global::B(source.StructValue != null ? MapToD(source.StructValue.Value) : default(global::D?)); + var target = new global::B( + source.StructValue != null ? MapToD(source.StructValue.Value) : default(global::D?) + ); return target; """ ); diff --git a/test/Riok.Mapperly.Tests/Mapping/ToStringFormattedTest.cs b/test/Riok.Mapperly.Tests/Mapping/ToStringFormattedTest.cs index 98cbd51123..c0c857e10e 100644 --- a/test/Riok.Mapperly.Tests/Mapping/ToStringFormattedTest.cs +++ b/test/Riok.Mapperly.Tests/Mapping/ToStringFormattedTest.cs @@ -47,7 +47,11 @@ public void RecordMultiplePropertiesToStringWithDifferentFormats() .Should() .HaveSingleMethodBody( """ - var target = new global::B(source.Value.ToString(), source.Value1.ToString("dd.MM.yyyy"), source.Value2.ToString("yyyy-MM-dd")); + var target = new global::B( + source.Value.ToString(), + source.Value1.ToString("dd.MM.yyyy"), + source.Value2.ToString("yyyy-MM-dd") + ); return target; """ ); diff --git a/test/Riok.Mapperly.Tests/Mapping/UseStaticMapperTest.cs b/test/Riok.Mapperly.Tests/Mapping/UseStaticMapperTest.cs index b5d05fa98a..34acffab3f 100644 --- a/test/Riok.Mapperly.Tests/Mapping/UseStaticMapperTest.cs +++ b/test/Riok.Mapperly.Tests/Mapping/UseStaticMapperTest.cs @@ -433,10 +433,13 @@ public void UseStaticGenericMapperStaticMethodFromAnotherAssemblyAsReference() "ProjectToTarget", """ #nullable disable - return System.Linq.Queryable.Select(source, x => new global::Mapper.Target() - { - DateTime = new global::System.DateTimeOffset(x.DateTime, global::System.TimeSpan.Zero), - }); + return System.Linq.Queryable.Select( + source, + x => new global::Mapper.Target() + { + DateTime = new global::System.DateTimeOffset(x.DateTime, global::System.TimeSpan.Zero), + } + ); #nullable enable """ ); @@ -456,10 +459,13 @@ public void UseStaticGenericMapperStaticMethodFromAnotherAssemblyAsCompiledAssem "ProjectToTarget", """ #nullable disable - return System.Linq.Queryable.Select(source, x => new global::Mapper.Target() - { - DateTime = global::Riok.Mapperly.TestDependency.Mapper.DateTimeMapper.MapToDateTimeOffset(x.DateTime), - }); + return System.Linq.Queryable.Select( + source, + x => new global::Mapper.Target() + { + DateTime = global::Riok.Mapperly.TestDependency.Mapper.DateTimeMapper.MapToDateTimeOffset(x.DateTime), + } + ); #nullable enable """ ); diff --git a/test/Riok.Mapperly.Tests/_snapshots/GenericTest.WithGenericSourceAndTargetAndEnabledReferenceHandling#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/GenericTest.WithGenericSourceAndTargetAndEnabledReferenceHandling#Mapper.g.verified.cs index dc8be90112..2d4edde4f9 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/GenericTest.WithGenericSourceAndTargetAndEnabledReferenceHandling#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/GenericTest.WithGenericSourceAndTargetAndEnabledReferenceHandling#Mapper.g.verified.cs @@ -19,13 +19,19 @@ private partial TTarget Map(TSource source) [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] private partial global::B MapToB(global::A source) { - return MapToB1(source, new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler()); + return MapToB1( + source, + new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler() + ); } [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] private partial global::D MapToD(global::C source) { - return MapToD1(source, new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler()); + return MapToD1( + source, + new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler() + ); } [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] diff --git a/test/Riok.Mapperly.Tests/_snapshots/ObjectPropertyUseNamedMappingTest.ShouldUseReferencedMappingOnSelectedPropertiesWithRecordConstructors#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/ObjectPropertyUseNamedMappingTest.ShouldUseReferencedMappingOnSelectedPropertiesWithRecordConstructors#Mapper.g.verified.cs index f03efd8b52..632b87ed60 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/ObjectPropertyUseNamedMappingTest.ShouldUseReferencedMappingOnSelectedPropertiesWithRecordConstructors#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/ObjectPropertyUseNamedMappingTest.ShouldUseReferencedMappingOnSelectedPropertiesWithRecordConstructors#Mapper.g.verified.cs @@ -6,7 +6,11 @@ public partial class Mapper [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] public partial global::B Map(global::A source) { - var target = new global::B(DefaultStringMapping(source.StringValue), ModifyString(source.StringValue1), ModifyString2(source.StringValue2)); + var target = new global::B( + DefaultStringMapping(source.StringValue), + ModifyString(source.StringValue1), + ModifyString2(source.StringValue2) + ); return target; } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/ObjectPropertyUseNamedMappingTest.UserMethodReturnsNullableShouldThrow#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/ObjectPropertyUseNamedMappingTest.UserMethodReturnsNullableShouldThrow#Mapper.g.verified.cs index d5d610dbe8..06dcc2e8e8 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/ObjectPropertyUseNamedMappingTest.UserMethodReturnsNullableShouldThrow#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/ObjectPropertyUseNamedMappingTest.UserMethodReturnsNullableShouldThrow#Mapper.g.verified.cs @@ -7,7 +7,9 @@ public partial class Mapper public partial global::B Map(global::A source) { var target = new global::B(); - target.Value = ToC(source.Name ?? throw new System.ArgumentNullException(nameof(source.Name))) ?? throw new System.NullReferenceException("ToC returned null"); + target.Value = ToC( + source.Name ?? throw new System.ArgumentNullException(nameof(source.Name)) + ) ?? throw new System.NullReferenceException("ToC returned null"); return target; } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionDerivedTypeTest.AbstractBaseClassDerivedTypesShouldWork#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionDerivedTypeTest.AbstractBaseClassDerivedTypesShouldWork#Mapper.g.verified.cs index 1273f3adec..8297a98c9e 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionDerivedTypeTest.AbstractBaseClassDerivedTypesShouldWork#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionDerivedTypeTest.AbstractBaseClassDerivedTypesShouldWork#Mapper.g.verified.cs @@ -7,17 +7,20 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => (global::B)(x is global::ASubType1 ? new global::BSubType1() - { - Value1 = ((global::ASubType1)x).Value1, - BaseValueB = ((global::ASubType1)x).BaseValueA, - StringValue = ((global::ASubType1)x).StringValue, - } : x is global::ASubType2 ? new global::BSubType2() - { - Value2 = ((global::ASubType2)x).Value2, - BaseValueB = ((global::ASubType2)x).BaseValueA, - StringValue = ((global::ASubType2)x).StringValue, - } : default)); + return System.Linq.Queryable.Select( + source, + x => (global::B)(x is global::ASubType1 ? new global::BSubType1() + { + Value1 = ((global::ASubType1)x).Value1, + BaseValueB = ((global::ASubType1)x).BaseValueA, + StringValue = ((global::ASubType1)x).StringValue, + } : x is global::ASubType2 ? new global::BSubType2() + { + Value2 = ((global::ASubType2)x).Value2, + BaseValueB = ((global::ASubType2)x).BaseValueA, + StringValue = ((global::ASubType2)x).StringValue, + } : default) + ); #nullable enable } diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionEnumTest.EnumFromString#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionEnumTest.EnumFromString#Mapper.g.verified.cs index 4b9cb7c30b..8315267759 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionEnumTest.EnumFromString#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionEnumTest.EnumFromString#Mapper.g.verified.cs @@ -7,10 +7,13 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - Value = System.Enum.Parse(x.Value, false), - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + Value = System.Enum.Parse(x.Value, false), + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionEnumTest.EnumToAnotherEnum#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionEnumTest.EnumToAnotherEnum#Mapper.g.verified.cs index 744366b540..5e8afdda6f 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionEnumTest.EnumToAnotherEnum#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionEnumTest.EnumToAnotherEnum#Mapper.g.verified.cs @@ -7,10 +7,13 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - Value = (global::D)x.Value, - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + Value = (global::D)x.Value, + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionEnumTest.EnumToString#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionEnumTest.EnumToString#Mapper.g.verified.cs index 08e5f35e99..dbb9217497 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionEnumTest.EnumToString#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionEnumTest.EnumToString#Mapper.g.verified.cs @@ -7,10 +7,13 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - Value = (string)x.Value.ToString(), - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + Value = (string)x.Value.ToString(), + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionEnumerableTest.ArrayToArrayExplicitCast#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionEnumerableTest.ArrayToArrayExplicitCast#Mapper.g.verified.cs index 4529788e9f..6aee1ecb3e 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionEnumerableTest.ArrayToArrayExplicitCast#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionEnumerableTest.ArrayToArrayExplicitCast#Mapper.g.verified.cs @@ -7,10 +7,13 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - Values = global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(x.Values, x1 => (int)x1)), - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + Values = global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(x.Values, x1 => (int)x1)), + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionEnumerableTest.ExplicitCast#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionEnumerableTest.ExplicitCast#Mapper.g.verified.cs index bee9b5998c..6bede6c45f 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionEnumerableTest.ExplicitCast#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionEnumerableTest.ExplicitCast#Mapper.g.verified.cs @@ -7,10 +7,13 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - Values = global::System.Linq.Enumerable.Select(x.Values, x1 => (int)x1), - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + Values = global::System.Linq.Enumerable.Select(x.Values, x1 => (int)x1), + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourceAndTargetProperty#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourceAndTargetProperty#Mapper.g.verified.cs index ce653fafe4..2724d01d1e 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourceAndTargetProperty#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourceAndTargetProperty#Mapper.g.verified.cs @@ -7,10 +7,13 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - StringValue = x.StringValue, - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + StringValue = x.StringValue, + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourceAndTargetPropertyWithNoNullAssignmentAndThrowShouldBeIgnored#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourceAndTargetPropertyWithNoNullAssignmentAndThrowShouldBeIgnored#Mapper.g.verified.cs index ce653fafe4..2724d01d1e 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourceAndTargetPropertyWithNoNullAssignmentAndThrowShouldBeIgnored#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourceAndTargetPropertyWithNoNullAssignmentAndThrowShouldBeIgnored#Mapper.g.verified.cs @@ -7,10 +7,13 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - StringValue = x.StringValue, - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + StringValue = x.StringValue, + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourceAndTargetValueTypeProperty#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourceAndTargetValueTypeProperty#Mapper.g.verified.cs index a0b66ad027..d44838973d 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourceAndTargetValueTypeProperty#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourceAndTargetValueTypeProperty#Mapper.g.verified.cs @@ -7,10 +7,13 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - IntValue = x.IntValue, - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + IntValue = x.IntValue, + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourcePathAutoFlatten#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourcePathAutoFlatten#Mapper.g.verified.cs index 858327e5a5..b57e4f88b2 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourcePathAutoFlatten#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourcePathAutoFlatten#Mapper.g.verified.cs @@ -7,10 +7,13 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - NestedValue = x.Nested != null ? x.Nested.Value : default, - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + NestedValue = x.Nested != null ? x.Nested.Value : default, + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourcePathAutoFlattenString#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourcePathAutoFlattenString#Mapper.g.verified.cs index ac24afe305..fdf2b3390d 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourcePathAutoFlattenString#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourcePathAutoFlattenString#Mapper.g.verified.cs @@ -7,10 +7,13 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - NestedValue = x.Nested != null ? x.Nested.Value : "", - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + NestedValue = x.Nested != null ? x.Nested.Value : "", + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourcePathManuallyFlatten#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourcePathManuallyFlatten#Mapper.g.verified.cs index 2b6973479a..d3d89104d6 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourcePathManuallyFlatten#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourcePathManuallyFlatten#Mapper.g.verified.cs @@ -7,10 +7,13 @@ public partial class Mapper public partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable q) { #nullable disable - return System.Linq.Queryable.Select(q, x => new global::B() - { - NestedValue4 = x.Nested != null && x.Nested.Nested2 != null ? x.Nested.Nested2.Value3 : default, - }); + return System.Linq.Queryable.Select( + q, + x => new global::B() + { + NestedValue4 = x.Nested != null && x.Nested.Nested2 != null ? x.Nested.Nested2.Value3 : default, + } + ); #nullable enable } diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourceProperty#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourceProperty#Mapper.g.verified.cs index b9781761ab..51656d2b3e 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourceProperty#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourceProperty#Mapper.g.verified.cs @@ -7,10 +7,13 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - StringValue = x.StringValue ?? "", - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + StringValue = x.StringValue ?? "", + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourceValueTypeProperty#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourceValueTypeProperty#Mapper.g.verified.cs index 1928a21146..b16d43f55e 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourceValueTypeProperty#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableSourceValueTypeProperty#Mapper.g.verified.cs @@ -7,10 +7,13 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - IntValue = x.IntValue ?? default, - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + IntValue = x.IntValue ?? default, + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableTargetProperty#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableTargetProperty#Mapper.g.verified.cs index ce653fafe4..2724d01d1e 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableTargetProperty#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableTargetProperty#Mapper.g.verified.cs @@ -7,10 +7,13 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - StringValue = x.StringValue, - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + StringValue = x.StringValue, + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableTargetValueTypeProperty#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableTargetValueTypeProperty#Mapper.g.verified.cs index a0b66ad027..d44838973d 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableTargetValueTypeProperty#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionNullableTest.ClassToClassNullableTargetValueTypeProperty#Mapper.g.verified.cs @@ -7,10 +7,13 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - IntValue = x.IntValue, - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + IntValue = x.IntValue, + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.ClassToClass#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.ClassToClass#Mapper.g.verified.cs index ce653fafe4..2724d01d1e 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.ClassToClass#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.ClassToClass#Mapper.g.verified.cs @@ -7,10 +7,13 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - StringValue = x.StringValue, - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + StringValue = x.StringValue, + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.ClassToClassMultipleProperties#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.ClassToClassMultipleProperties#Mapper.g.verified.cs index 7061e38acd..7729e6793c 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.ClassToClassMultipleProperties#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.ClassToClassMultipleProperties#Mapper.g.verified.cs @@ -7,12 +7,15 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - StringValue = x.StringValue, - IntValue = x.IntValue, - CharValue = x.CharValue, - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + StringValue = x.StringValue, + IntValue = x.IntValue, + CharValue = x.CharValue, + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.ClassToClassNested#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.ClassToClassNested#Mapper.g.verified.cs index 2be6a8802b..dec119f2aa 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.ClassToClassNested#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.ClassToClassNested#Mapper.g.verified.cs @@ -7,14 +7,17 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - StringValue = x.StringValue, - OtherValue = new global::D() + return System.Linq.Queryable.Select( + source, + x => new global::B() { - IntValue = x.OtherValue.IntValue, - }, - }); + StringValue = x.StringValue, + OtherValue = new global::D() + { + IntValue = x.OtherValue.IntValue, + }, + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.ClassToClassNestedMemberAttribute#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.ClassToClassNestedMemberAttribute#Mapper.g.verified.cs index 84f41eaf3c..69c71e7b30 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.ClassToClassNestedMemberAttribute#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.ClassToClassNestedMemberAttribute#Mapper.g.verified.cs @@ -7,10 +7,13 @@ public partial class Mapper partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - Id = x.Value.Id, - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + Id = x.Value.Id, + } + ); #nullable enable } diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.ClassToClassWithConfigs#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.ClassToClassWithConfigs#Mapper.g.verified.cs index 7791632444..767df932e7 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.ClassToClassWithConfigs#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.ClassToClassWithConfigs#Mapper.g.verified.cs @@ -7,18 +7,21 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - StringValue2 = x.StringValue, - NestedValue = new global::D() + return System.Linq.Queryable.Select( + source, + x => new global::B() { - IntValue = (int)x.NestedValue.LongValue, - NestedValue = new global::F() + StringValue2 = x.StringValue, + NestedValue = new global::D() { - ShortValue = x.NestedValue.NestedValue.ShortValue, + IntValue = (int)x.NestedValue.LongValue, + NestedValue = new global::F() + { + ShortValue = x.NestedValue.NestedValue.ShortValue, + }, }, - }, - }); + } + ); #nullable enable } diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.CtorShouldSkipUnmatchedOptionalParameters#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.CtorShouldSkipUnmatchedOptionalParameters#Mapper.g.verified.cs index 7900b0ccd3..d175f46203 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.CtorShouldSkipUnmatchedOptionalParameters#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.CtorShouldSkipUnmatchedOptionalParameters#Mapper.g.verified.cs @@ -7,10 +7,13 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B(x.StringValue) - { - IntValue = x.IntValue, - }); + return System.Linq.Queryable.Select( + source, + x => new global::B(x.StringValue) + { + IntValue = x.IntValue, + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.QueryablePropertyWithStringFormat#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.QueryablePropertyWithStringFormat#Mapper.g.verified.cs index 8056390c0c..b8922a94d4 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.QueryablePropertyWithStringFormat#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.QueryablePropertyWithStringFormat#Mapper.g.verified.cs @@ -7,10 +7,13 @@ public partial class Mapper partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - Value = x.Value.ToString("C"), - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + Value = x.Value.ToString("C"), + } + ); #nullable enable } diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.RecordToRecordManualFlatteningInsideList#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.RecordToRecordManualFlatteningInsideList#Mapper.g.verified.cs index df250cbe42..dd598b6e4d 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.RecordToRecordManualFlatteningInsideList#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.RecordToRecordManualFlatteningInsideList#Mapper.g.verified.cs @@ -7,7 +7,13 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B(x.Id.ToString(), global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(x.Values, x1 => x1.Value)))); + return System.Linq.Queryable.Select( + source, + x => new global::B( + x.Id.ToString(), + global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(x.Values, x1 => x1.Value)) + ) + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.RecordToRecordManualListMapping#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.RecordToRecordManualListMapping#Mapper.g.verified.cs index d46efa356a..cea227e427 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.RecordToRecordManualListMapping#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.RecordToRecordManualListMapping#Mapper.g.verified.cs @@ -7,7 +7,13 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B(x.Id.ToString(), global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.OrderBy(global::System.Linq.Enumerable.Select(x.Values, x => x.Value), x => x)))); + return System.Linq.Queryable.Select( + source, + x => new global::B( + x.Id.ToString(), + global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.OrderBy(global::System.Linq.Enumerable.Select(x.Values, x => x.Value), x => x)) + ) + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.ReferenceLoopCtor#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.ReferenceLoopCtor#Mapper.g.verified.cs index 49d7ab070d..13b365c785 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.ReferenceLoopCtor#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.ReferenceLoopCtor#Mapper.g.verified.cs @@ -7,13 +7,18 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B(x.Parent != null ? new global::B() - { - IntValue = x.Parent.IntValue, - } : default) - { - IntValue = x.IntValue, - }); + return System.Linq.Queryable.Select( + source, + x => new global::B( + x.Parent != null ? new global::B() + { + IntValue = x.Parent.IntValue, + } : default + ) + { + IntValue = x.IntValue, + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.ReferenceLoopInitProperty#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.ReferenceLoopInitProperty#Mapper.g.verified.cs index 27393fd0b2..e08bbc9309 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.ReferenceLoopInitProperty#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionTest.ReferenceLoopInitProperty#Mapper.g.verified.cs @@ -7,14 +7,17 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - Parent = x.Parent != null ? new global::B() + return System.Linq.Queryable.Select( + source, + x => new global::B() { - IntValue = x.Parent.IntValue, - } : default, - IntValue = x.IntValue, - }); + Parent = x.Parent != null ? new global::B() + { + IntValue = x.Parent.IntValue, + } : default, + IntValue = x.IntValue, + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUseNamedMappingTest.ShouldUseReferencedMappingOnSelectedProperties#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUseNamedMappingTest.ShouldUseReferencedMappingOnSelectedProperties#Mapper.g.verified.cs index 3c564d278e..d2eb0e9fb5 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUseNamedMappingTest.ShouldUseReferencedMappingOnSelectedProperties#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUseNamedMappingTest.ShouldUseReferencedMappingOnSelectedProperties#Mapper.g.verified.cs @@ -7,12 +7,15 @@ public partial class Mapper public partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - StringValue = x.StringValue, - StringValue1 = x.StringValue1 + "-modified", - StringValue2 = x.StringValue2 + "-modified2", - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + StringValue = x.StringValue, + StringValue1 = x.StringValue1 + "-modified", + StringValue2 = x.StringValue2 + "-modified2", + } + ); #nullable enable } diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUseNamedMappingTest.ShouldUseReferencedMappingOnSelectedPropertiesWithDisabledAutoUserMappings#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUseNamedMappingTest.ShouldUseReferencedMappingOnSelectedPropertiesWithDisabledAutoUserMappings#Mapper.g.verified.cs index 3c564d278e..d2eb0e9fb5 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUseNamedMappingTest.ShouldUseReferencedMappingOnSelectedPropertiesWithDisabledAutoUserMappings#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUseNamedMappingTest.ShouldUseReferencedMappingOnSelectedPropertiesWithDisabledAutoUserMappings#Mapper.g.verified.cs @@ -7,12 +7,15 @@ public partial class Mapper public partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - StringValue = x.StringValue, - StringValue1 = x.StringValue1 + "-modified", - StringValue2 = x.StringValue2 + "-modified2", - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + StringValue = x.StringValue, + StringValue1 = x.StringValue1 + "-modified", + StringValue2 = x.StringValue2 + "-modified2", + } + ); #nullable enable } diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUseNamedMappingTest.ShouldUseReferencedUserDefinedMappingOnSelectedProperties#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUseNamedMappingTest.ShouldUseReferencedUserDefinedMappingOnSelectedProperties#Mapper.g.verified.cs index 67a6ef2ca3..b4eff1a057 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUseNamedMappingTest.ShouldUseReferencedUserDefinedMappingOnSelectedProperties#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUseNamedMappingTest.ShouldUseReferencedUserDefinedMappingOnSelectedProperties#Mapper.g.verified.cs @@ -7,12 +7,15 @@ public partial class Mapper public partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - Value = new global::D(x.Value.Value.ToString("P")), - Value2 = new global::D(x.Value2.Value.ToString("C")), - ValueDefault = new global::D(x.ValueDefault.Value.ToString("N")), - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + Value = new global::D(x.Value.Value.ToString("P")), + Value2 = new global::D(x.Value2.Value.ToString("C")), + ValueDefault = new global::D(x.ValueDefault.Value.ToString("N")), + } + ); #nullable enable } diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUseNamedMappingTest.ShouldUseReferencedUserDefinedMappingOnSelectedPropertiesWithDisabledAutoUserMappings#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUseNamedMappingTest.ShouldUseReferencedUserDefinedMappingOnSelectedPropertiesWithDisabledAutoUserMappings#Mapper.g.verified.cs index 67a6ef2ca3..b4eff1a057 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUseNamedMappingTest.ShouldUseReferencedUserDefinedMappingOnSelectedPropertiesWithDisabledAutoUserMappings#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUseNamedMappingTest.ShouldUseReferencedUserDefinedMappingOnSelectedPropertiesWithDisabledAutoUserMappings#Mapper.g.verified.cs @@ -7,12 +7,15 @@ public partial class Mapper public partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - Value = new global::D(x.Value.Value.ToString("P")), - Value2 = new global::D(x.Value2.Value.ToString("C")), - ValueDefault = new global::D(x.ValueDefault.Value.ToString("N")), - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + Value = new global::D(x.Value.Value.ToString("P")), + Value2 = new global::D(x.Value2.Value.ToString("C")), + ValueDefault = new global::D(x.ValueDefault.Value.ToString("N")), + } + ); #nullable enable } diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUseNamedMappingTest.TwoQueryableMappingsWithNamedUsedMappingsAndAmbiguousName#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUseNamedMappingTest.TwoQueryableMappingsWithNamedUsedMappingsAndAmbiguousName#Mapper.g.verified.cs index d702a71520..964da70750 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUseNamedMappingTest.TwoQueryableMappingsWithNamedUsedMappingsAndAmbiguousName#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUseNamedMappingTest.TwoQueryableMappingsWithNamedUsedMappingsAndAmbiguousName#Mapper.g.verified.cs @@ -7,7 +7,14 @@ public partial class Mapper public partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B(x.StringValue, x.StringValue1 + "-modified", x.StringValue2 + "-modified2")); + return System.Linq.Queryable.Select( + source, + x => new global::B( + x.StringValue, + x.StringValue1 + "-modified", + x.StringValue2 + "-modified2" + ) + ); #nullable enable } @@ -15,21 +22,36 @@ public partial class Mapper public partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::D(x.StringValue, x.StringValue1 + "-modified", x.StringValue2 + "-modified2")); + return System.Linq.Queryable.Select( + source, + x => new global::D( + x.StringValue, + x.StringValue1 + "-modified", + x.StringValue2 + "-modified2" + ) + ); #nullable enable } [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] private partial global::B Map(global::A source) { - var target = new global::B(DefaultStringMapping(source.StringValue), ModifyString(source.StringValue1), ModifyString2(source.StringValue2)); + var target = new global::B( + DefaultStringMapping(source.StringValue), + ModifyString(source.StringValue1), + ModifyString2(source.StringValue2) + ); return target; } [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] private partial global::D Map(global::C source) { - var target = new global::D(DefaultStringMapping(source.StringValue), ModifyString(source.StringValue1), ModifyString2(source.StringValue2)); + var target = new global::D( + DefaultStringMapping(source.StringValue), + ModifyString(source.StringValue1), + ModifyString2(source.StringValue2) + ); return target; } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassInlinedExpression#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassInlinedExpression#Mapper.g.verified.cs index 6e34c8e85f..1ad5613152 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassInlinedExpression#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassInlinedExpression#Mapper.g.verified.cs @@ -7,11 +7,14 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - StringValue = x.StringValue, - NestedValue = new global::D { Value = x.NestedValue.Value + "-mapped" }, - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + StringValue = x.StringValue, + NestedValue = new global::D { Value = x.NestedValue.Value + "-mapped" }, + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassInlinedSingleDeclaration#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassInlinedSingleDeclaration#Mapper.g.verified.cs index 43067ed7ee..d3594af366 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassInlinedSingleDeclaration#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassInlinedSingleDeclaration#Mapper.g.verified.cs @@ -7,11 +7,14 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - StringValue = x.StringValue, - NestedValue = new global::D { Value = x.NestedValue.Value + "-mapped" }, - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + StringValue = x.StringValue, + NestedValue = new global::D { Value = x.NestedValue.Value + "-mapped" }, + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassInlinedSingleStatement#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassInlinedSingleStatement#Mapper.g.verified.cs index 43067ed7ee..d3594af366 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassInlinedSingleStatement#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassInlinedSingleStatement#Mapper.g.verified.cs @@ -7,11 +7,14 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - StringValue = x.StringValue, - NestedValue = new global::D { Value = x.NestedValue.Value + "-mapped" }, - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + StringValue = x.StringValue, + NestedValue = new global::D { Value = x.NestedValue.Value + "-mapped" }, + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassNonInlinedMethod#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassNonInlinedMethod#Mapper.g.verified.cs index 808f0df12f..7064a4a566 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassNonInlinedMethod#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassNonInlinedMethod#Mapper.g.verified.cs @@ -7,11 +7,14 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - StringValue = x.StringValue, - NestedValue = MapToD(x.NestedValue), - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + StringValue = x.StringValue, + NestedValue = MapToD(x.NestedValue), + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassUserImplementedOrdering#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassUserImplementedOrdering#Mapper.g.verified.cs index 89bbaa8ecc..3f6bf05cad 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassUserImplementedOrdering#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassUserImplementedOrdering#Mapper.g.verified.cs @@ -7,11 +7,14 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - StringValue = x.StringValue, - NestedValues = global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.OrderBy(x.NestedValues, x => x.Value)), - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + StringValue = x.StringValue, + NestedValues = global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.OrderBy(x.NestedValues, x => x.Value)), + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassUserImplementedOrderingWithMappingAndParameterHiding#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassUserImplementedOrderingWithMappingAndParameterHiding#Mapper.g.verified.cs index 6d9570e12d..c8b50cbdeb 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassUserImplementedOrderingWithMappingAndParameterHiding#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassUserImplementedOrderingWithMappingAndParameterHiding#Mapper.g.verified.cs @@ -7,14 +7,17 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - StringValue = x.StringValue, - NestedValues = global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(global::System.Linq.Enumerable.OrderBy(x.NestedValues, x => x.Value), v => new global::D() + return System.Linq.Queryable.Select( + source, + x => new global::B() { - Value = v.Value, - })), - }); + StringValue = x.StringValue, + NestedValues = global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(global::System.Linq.Enumerable.OrderBy(x.NestedValues, x => x.Value), v => new global::D() + { + Value = v.Value, + })), + } + ); #nullable enable } diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassUserImplementedOrderingWithTwoNestedMappings#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassUserImplementedOrderingWithTwoNestedMappings#Mapper.g.verified.cs index dcc486580c..822d271a3c 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassUserImplementedOrderingWithTwoNestedMappings#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassUserImplementedOrderingWithTwoNestedMappings#Mapper.g.verified.cs @@ -7,14 +7,17 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - StringValue = x.StringValue + "-mod", - NestedValues = global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(global::System.Linq.Enumerable.OrderBy(x.NestedValues, x => x.Value), x => new global::D() + return System.Linq.Queryable.Select( + source, + x => new global::B() { - Value = x.Value + "-mod", - })), - }); + StringValue = x.StringValue + "-mod", + NestedValues = global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(global::System.Linq.Enumerable.OrderBy(x.NestedValues, x => x.Value), x => new global::D() + { + Value = x.Value + "-mod", + })), + } + ); #nullable enable } diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassUserImplementedParenthesizedLambdaOrdering#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassUserImplementedParenthesizedLambdaOrdering#Mapper.g.verified.cs index 719800d262..ddf7375076 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassUserImplementedParenthesizedLambdaOrdering#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassUserImplementedParenthesizedLambdaOrdering#Mapper.g.verified.cs @@ -7,11 +7,14 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - StringValue = x.StringValue, - NestedValues = global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.OrderBy(x.NestedValues, (x) => x.Value)), - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + StringValue = x.StringValue, + NestedValues = global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.OrderBy(x.NestedValues, (x) => x.Value)), + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassUserImplementedWithTargetTypeNew#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassUserImplementedWithTargetTypeNew#Mapper.g.verified.cs index e05ef2aabe..d2b14fd28c 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassUserImplementedWithTargetTypeNew#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassUserImplementedWithTargetTypeNew#Mapper.g.verified.cs @@ -7,10 +7,13 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - Value = new global::System.DateTimeOffset(x.Value, global::System.TimeSpan.Zero), - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + Value = new global::System.DateTimeOffset(x.Value, global::System.TimeSpan.Zero), + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassUserImplementedWithTargetTypeNewInitializer#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassUserImplementedWithTargetTypeNewInitializer#Mapper.g.verified.cs index 965d2902ec..c70bfa88b2 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassUserImplementedWithTargetTypeNewInitializer#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassUserImplementedWithTargetTypeNewInitializer#Mapper.g.verified.cs @@ -7,10 +7,13 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - Value = new global::C(1) { Value2 = 10 }, - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + Value = new global::C(1) { Value2 = 10 }, + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassUserImplementedWithUsingMappings#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassUserImplementedWithUsingMappings#Mapper.g.verified.cs index e05ef2aabe..d2b14fd28c 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassUserImplementedWithUsingMappings#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/QueryableProjectionUserImplementedTest.ClassToClassUserImplementedWithUsingMappings#Mapper.g.verified.cs @@ -7,10 +7,13 @@ public partial class Mapper private partial global::System.Linq.IQueryable Map(global::System.Linq.IQueryable source) { #nullable disable - return System.Linq.Queryable.Select(source, x => new global::B() - { - Value = new global::System.DateTimeOffset(x.Value, global::System.TimeSpan.Zero), - }); + return System.Linq.Queryable.Select( + source, + x => new global::B() + { + Value = new global::System.DateTimeOffset(x.Value, global::System.TimeSpan.Zero), + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.ArrayShouldWork#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.ArrayShouldWork#Mapper.g.verified.cs index 2261ee063c..47727072f5 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.ArrayShouldWork#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.ArrayShouldWork#Mapper.g.verified.cs @@ -6,7 +6,10 @@ public partial class Mapper [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] private partial global::B Map(global::A source) { - return MapToB(source, new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler()); + return MapToB( + source, + new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler() + ); } [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] diff --git a/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.EnumerableShouldWork#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.EnumerableShouldWork#Mapper.g.verified.cs index b3aef930b8..867a3ddd12 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.EnumerableShouldWork#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.EnumerableShouldWork#Mapper.g.verified.cs @@ -6,7 +6,10 @@ public partial class Mapper [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] private partial global::B Map(global::A source) { - return MapToB(source, new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler()); + return MapToB( + source, + new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler() + ); } [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] diff --git a/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.ManuallyMappedPropertiesShouldWork#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.ManuallyMappedPropertiesShouldWork#Mapper.g.verified.cs index 840704cf3f..6b0075b040 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.ManuallyMappedPropertiesShouldWork#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.ManuallyMappedPropertiesShouldWork#Mapper.g.verified.cs @@ -6,13 +6,19 @@ public partial class Mapper [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] private partial global::B MapToB(global::A source) { - return MapToB2(source, new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler()); + return MapToB2( + source, + new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler() + ); } [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] private partial global::B MapToB1(global::A source) { - return MapToB3(source, new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler()); + return MapToB3( + source, + new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler() + ); } [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] diff --git a/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.MultipleUserDefinedWithSpecifiedDefault#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.MultipleUserDefinedWithSpecifiedDefault#Mapper.g.verified.cs index 9d24622ee5..03932a809c 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.MultipleUserDefinedWithSpecifiedDefault#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.MultipleUserDefinedWithSpecifiedDefault#Mapper.g.verified.cs @@ -6,19 +6,28 @@ public partial class Mapper [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] public partial global::B Map(global::A a) { - return MapToB(a, new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler()); + return MapToB( + a, + new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler() + ); } [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] private partial global::D MapD(global::C source) { - return MapToD(source, new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler()); + return MapToD( + source, + new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler() + ); } [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] private partial global::D MapDIgnore(global::C source) { - return MapToD1(source, new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler()); + return MapToD1( + source, + new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler() + ); } [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] diff --git a/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.ObjectFactoryShouldWork#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.ObjectFactoryShouldWork#Mapper.g.verified.cs index 4f5bab7133..63f8e8a8d9 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.ObjectFactoryShouldWork#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.ObjectFactoryShouldWork#Mapper.g.verified.cs @@ -6,7 +6,10 @@ public partial class Mapper [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] private partial global::B Map(global::A a) { - return MapToB(a, new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler()); + return MapToB( + a, + new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler() + ); } [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] diff --git a/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.ShouldWork#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.ShouldWork#Mapper.g.verified.cs index fb90c04c44..c263ab450e 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.ShouldWork#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.ShouldWork#Mapper.g.verified.cs @@ -6,7 +6,10 @@ public partial class Mapper [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] private partial global::B Map(global::A source) { - return MapToB(source, new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler()); + return MapToB( + source, + new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler() + ); } [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] diff --git a/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.UserImplementedWithReferenceHandlerShouldWork#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.UserImplementedWithReferenceHandlerShouldWork#Mapper.g.verified.cs index 4ec7f00b41..05237ad2e6 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.UserImplementedWithReferenceHandlerShouldWork#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.UserImplementedWithReferenceHandlerShouldWork#Mapper.g.verified.cs @@ -6,7 +6,10 @@ public partial class Mapper [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] private partial global::B Map(global::A a) { - return MapToB(a, new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler()); + return MapToB( + a, + new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler() + ); } [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] diff --git a/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.UserImplementedWithoutReferenceHandlerShouldWork#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.UserImplementedWithoutReferenceHandlerShouldWork#Mapper.g.verified.cs index 9e1728435a..4d01ef652c 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.UserImplementedWithoutReferenceHandlerShouldWork#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/ReferenceHandlingTest.UserImplementedWithoutReferenceHandlerShouldWork#Mapper.g.verified.cs @@ -6,7 +6,10 @@ public partial class Mapper [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] private partial global::B Map(global::A a) { - return MapToB(a, new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler()); + return MapToB( + a, + new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler() + ); } [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] diff --git a/test/Riok.Mapperly.Tests/_snapshots/RuntimeTargetTypeMappingTest.WithGenericSourceAndTarget#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/RuntimeTargetTypeMappingTest.WithGenericSourceAndTarget#Mapper.g.verified.cs index 339a9f95ab..d90aaf4dcc 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/RuntimeTargetTypeMappingTest.WithGenericSourceAndTarget#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/RuntimeTargetTypeMappingTest.WithGenericSourceAndTarget#Mapper.g.verified.cs @@ -18,10 +18,13 @@ public partial class Mapper private partial global::System.Linq.IQueryable ProjectToB(global::System.Linq.IQueryable q) { #nullable disable - return System.Linq.Queryable.Select(q, x => new global::B() - { - Value = x.Value, - }); + return System.Linq.Queryable.Select( + q, + x => new global::B() + { + Value = x.Value, + } + ); #nullable enable } @@ -29,10 +32,13 @@ public partial class Mapper private partial global::System.Linq.IQueryable ProjectToD(global::System.Linq.IQueryable q) { #nullable disable - return System.Linq.Queryable.Select(q, x => new global::D() - { - Value2 = x.Value2, - }); + return System.Linq.Queryable.Select( + q, + x => new global::D() + { + Value2 = x.Value2, + } + ); #nullable enable } } \ No newline at end of file diff --git a/test/Riok.Mapperly.Tests/_snapshots/RuntimeTargetTypeMappingTest.WithReferenceHandlingEnabled#Mapper.g.verified.cs b/test/Riok.Mapperly.Tests/_snapshots/RuntimeTargetTypeMappingTest.WithReferenceHandlingEnabled#Mapper.g.verified.cs index d6e76cc652..d2e973f6bc 100644 --- a/test/Riok.Mapperly.Tests/_snapshots/RuntimeTargetTypeMappingTest.WithReferenceHandlingEnabled#Mapper.g.verified.cs +++ b/test/Riok.Mapperly.Tests/_snapshots/RuntimeTargetTypeMappingTest.WithReferenceHandlingEnabled#Mapper.g.verified.cs @@ -18,13 +18,19 @@ private partial object Map(object source, global::System.Type targetType) [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] private partial global::B MapToB(global::A source) { - return MapToB1(source, new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler()); + return MapToB1( + source, + new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler() + ); } [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] private partial global::D MapToD(global::C source) { - return MapToD1(source, new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler()); + return MapToD1( + source, + new global::Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler() + ); } [global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")]