Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private static string GetMethodKey(MethodDeclarationSyntax node)
// Build a key from class name, method name, and parameter types
var className = node.Ancestors().OfType<TypeDeclarationSyntax>().FirstOrDefault()?.Identifier.Text ?? "";
var methodName = node.Identifier.Text;
var parameters = string.Join(",", node.ParameterList.Parameters.Select(p => p.Type?.ToString() ?? ""));
var parameters = string.Join(',', node.ParameterList.Parameters.Select(p => p.Type?.ToString() ?? ""));
return $"{className}.{methodName}({parameters})";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,8 @@
// The extension method extends IAssertionSource<T> where T is the type argument
// from the Assertion<T> base class.
string sourceType;
string genericTypeParam = null;

Check warning on line 363 in TUnit.Assertions.SourceGenerator/Generators/AssertionExtensionGenerator.cs

View workflow job for this annotation

GitHub Actions / integration-tests

Converting null literal or possible null value to non-nullable type.

Check warning on line 363 in TUnit.Assertions.SourceGenerator/Generators/AssertionExtensionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (fr-FR)

Conversion de littéral ayant une valeur null ou d'une éventuelle valeur null en type non-nullable.

Check warning on line 363 in TUnit.Assertions.SourceGenerator/Generators/AssertionExtensionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (de-DE)

Das NULL-Literal oder ein möglicher NULL-Wert wird in einen Non-Nullable-Typ konvertiert.

Check warning on line 363 in TUnit.Assertions.SourceGenerator/Generators/AssertionExtensionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (pl-PL)

Konwertowanie literału null lub możliwej wartości null na nienullowalny typ.

Check warning on line 363 in TUnit.Assertions.SourceGenerator/Generators/AssertionExtensionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (macos-latest)

Converting null literal or possible null value to non-nullable type.

Check warning on line 363 in TUnit.Assertions.SourceGenerator/Generators/AssertionExtensionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (ubuntu-latest)

Converting null literal or possible null value to non-nullable type.
string genericConstraint = null;

Check warning on line 364 in TUnit.Assertions.SourceGenerator/Generators/AssertionExtensionGenerator.cs

View workflow job for this annotation

GitHub Actions / integration-tests

Converting null literal or possible null value to non-nullable type.

Check warning on line 364 in TUnit.Assertions.SourceGenerator/Generators/AssertionExtensionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (fr-FR)

Conversion de littéral ayant une valeur null ou d'une éventuelle valeur null en type non-nullable.

Check warning on line 364 in TUnit.Assertions.SourceGenerator/Generators/AssertionExtensionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (de-DE)

Das NULL-Literal oder ein möglicher NULL-Wert wird in einen Non-Nullable-Typ konvertiert.

Check warning on line 364 in TUnit.Assertions.SourceGenerator/Generators/AssertionExtensionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (pl-PL)

Konwertowanie literału null lub możliwej wartości null na nienullowalny typ.

Check warning on line 364 in TUnit.Assertions.SourceGenerator/Generators/AssertionExtensionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (macos-latest)

Converting null literal or possible null value to non-nullable type.

Check warning on line 364 in TUnit.Assertions.SourceGenerator/Generators/AssertionExtensionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (ubuntu-latest)

Converting null literal or possible null value to non-nullable type.

if (isNullableOverload)
{
Expand All @@ -369,8 +369,8 @@
// because NRT annotations are erased at runtime - they're the same type to the CLR.
// Instead, just use the nullable version and accept both nullable and non-nullable sources.
sourceType = $"IAssertionSource<{typeParam.ToDisplayString()}>";
genericTypeParam = null;

Check warning on line 372 in TUnit.Assertions.SourceGenerator/Generators/AssertionExtensionGenerator.cs

View workflow job for this annotation

GitHub Actions / integration-tests

Converting null literal or possible null value to non-nullable type.

Check warning on line 372 in TUnit.Assertions.SourceGenerator/Generators/AssertionExtensionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (fr-FR)

Conversion de littéral ayant une valeur null ou d'une éventuelle valeur null en type non-nullable.

Check warning on line 372 in TUnit.Assertions.SourceGenerator/Generators/AssertionExtensionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (de-DE)

Das NULL-Literal oder ein möglicher NULL-Wert wird in einen Non-Nullable-Typ konvertiert.

Check warning on line 372 in TUnit.Assertions.SourceGenerator/Generators/AssertionExtensionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (pl-PL)

Konwertowanie literału null lub możliwej wartości null na nienullowalny typ.

Check warning on line 372 in TUnit.Assertions.SourceGenerator/Generators/AssertionExtensionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (macos-latest)

Converting null literal or possible null value to non-nullable type.

Check warning on line 372 in TUnit.Assertions.SourceGenerator/Generators/AssertionExtensionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (ubuntu-latest)

Converting null literal or possible null value to non-nullable type.
genericConstraint = null;

Check warning on line 373 in TUnit.Assertions.SourceGenerator/Generators/AssertionExtensionGenerator.cs

View workflow job for this annotation

GitHub Actions / integration-tests

Converting null literal or possible null value to non-nullable type.

Check warning on line 373 in TUnit.Assertions.SourceGenerator/Generators/AssertionExtensionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (fr-FR)

Conversion de littéral ayant une valeur null ou d'une éventuelle valeur null en type non-nullable.

Check warning on line 373 in TUnit.Assertions.SourceGenerator/Generators/AssertionExtensionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (de-DE)

Das NULL-Literal oder ein möglicher NULL-Wert wird in einen Non-Nullable-Typ konvertiert.

Check warning on line 373 in TUnit.Assertions.SourceGenerator/Generators/AssertionExtensionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (pl-PL)

Konwertowanie literału null lub możliwej wartości null na nienullowalny typ.

Check warning on line 373 in TUnit.Assertions.SourceGenerator/Generators/AssertionExtensionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (macos-latest)

Converting null literal or possible null value to non-nullable type.

Check warning on line 373 in TUnit.Assertions.SourceGenerator/Generators/AssertionExtensionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (ubuntu-latest)

Converting null literal or possible null value to non-nullable type.
}
else if (typeParam is ITypeParameterSymbol baseTypeParam)
{
Expand Down Expand Up @@ -422,7 +422,7 @@
if (allConstraints.Count > 0)
{
sourceBuilder.AppendLine();
sourceBuilder.Append($" {string.Join(" ", allConstraints)}");
sourceBuilder.Append($" {string.Join(' ', allConstraints)}");
}

sourceBuilder.AppendLine();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@ private static void GenerateMethod(StringBuilder sourceBuilder, string targetTyp
{
// Add generic constraints from the method
sourceBuilder.AppendLine();
sourceBuilder.Append($" {string.Join(" ", genericConstraints)}");
sourceBuilder.Append($" {string.Join(' ', genericConstraints)}");
}

sourceBuilder.AppendLine();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
public static string BuildAssertion = "MethodAssertionData";

private static readonly DiagnosticDescriptor MethodMustBeStaticRule = new DiagnosticDescriptor(
id: "TUNITGEN001",

Check warning on line 23 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / integration-tests

Check warning on line 23 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (fr-FR)

Activer le suivi de version d'analyseur pour le projet d'analyseur contenant la règle 'TUNITGEN001' (https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md)

Check warning on line 23 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (de-DE)

Check warning on line 23 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (pl-PL)

Włącz śledzenie wydań analizatora dla projektu analizatora zawierającego regułę „TUNITGEN001” (https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md)

Check warning on line 23 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (ubuntu-latest)

title: "Method must be static",
messageFormat: "Method '{0}' decorated with [GenerateAssertion] must be static",
category: "TUnit.Assertions.SourceGenerator",
Expand All @@ -29,7 +29,7 @@
description: "Methods decorated with [GenerateAssertion] must be static to be used in generated assertions.");

private static readonly DiagnosticDescriptor MethodMustHaveParametersRule = new DiagnosticDescriptor(
id: "TUNITGEN002",

Check warning on line 32 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / integration-tests

Check warning on line 32 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (fr-FR)

Activer le suivi de version d'analyseur pour le projet d'analyseur contenant la règle 'TUNITGEN002' (https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md)

Check warning on line 32 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (de-DE)

Check warning on line 32 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (pl-PL)

Włącz śledzenie wydań analizatora dla projektu analizatora zawierającego regułę „TUNITGEN002” (https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md)

Check warning on line 32 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (macos-latest)

Check warning on line 32 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (ubuntu-latest)

title: "Method must have at least one parameter",
messageFormat: "Method '{0}' decorated with [GenerateAssertion] must have at least one parameter (the value to assert)",
category: "TUnit.Assertions.SourceGenerator",
Expand All @@ -38,9 +38,9 @@
description: "Methods decorated with [GenerateAssertion] must have at least one parameter representing the value being asserted.");

private static readonly DiagnosticDescriptor UnsupportedReturnTypeRule = new DiagnosticDescriptor(
id: "TUNITGEN003",

Check warning on line 41 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / integration-tests

Check warning on line 41 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (fr-FR)

Activer le suivi de version d'analyseur pour le projet d'analyseur contenant la règle 'TUNITGEN003' (https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md)

Check warning on line 41 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (de-DE)

Check warning on line 41 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (pl-PL)

Włącz śledzenie wydań analizatora dla projektu analizatora zawierającego regułę „TUNITGEN003” (https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md)

Check warning on line 41 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (macos-latest)

Check warning on line 41 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (ubuntu-latest)

title: "Unsupported return type",
messageFormat: "Method '{0}' decorated with [GenerateAssertion] has unsupported return type '{1}'. Supported types are: bool, AssertionResult, AssertionResult<T>, Task<bool>, Task<AssertionResult>, Task<AssertionResult<T>>",

Check warning on line 43 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / integration-tests

The diagnostic message should not contain any line return character nor any leading or trailing whitespaces and should either be a single sentence without a trailing period or a multi-sentences with a trailing period

Check warning on line 43 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (fr-FR)

Le message du diagnostic ne doit comporter aucun caractère de retour de ligne et aucun espace blanc de début ou de fin, et doit tenir en une seule phrase sans point final ou en plusieurs phrases avec un point final

Check warning on line 43 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (de-DE)

Die Diagnosemeldung darf keine Zeilenvorschubzeichen und keine führenden oder nachfolgenden Leerzeichen enthalten und muss entweder einen einzelnen Satz ohne Satzendepunkt oder mehrere Sätze mit Satzendepunkt umfassen.

Check warning on line 43 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (pl-PL)

Komunikat dotyczący diagnostyki nie powinien zawierać znaku nowego wiersza ani odstępów na początku i końcu oraz powinien być pojedynczym zdaniem bez kropki na końcu lub wieloma zdaniami z kropkami na końcu

Check warning on line 43 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (macos-latest)

The diagnostic message should not contain any line return character nor any leading or trailing whitespaces and should either be a single sentence without a trailing period or a multi-sentences with a trailing period

Check warning on line 43 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (ubuntu-latest)

The diagnostic message should not contain any line return character nor any leading or trailing whitespaces and should either be a single sentence without a trailing period or a multi-sentences with a trailing period
category: "TUnit.Assertions.SourceGenerator",
defaultSeverity: DiagnosticSeverity.Error,
isEnabledByDefault: true,
Expand All @@ -49,7 +49,7 @@
private static readonly DiagnosticDescriptor RefStructRequiresInliningRule = new DiagnosticDescriptor(
id: "TUNITGEN004",
title: "Ref struct parameter requires method body inlining",
messageFormat: "Method '{0}' has ref struct parameter '{1}' of type '{2}'. Use InlineMethodBody = true and ensure the method has a single-expression or single-return-statement body",

Check warning on line 52 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (fr-FR)

Le message du diagnostic ne doit comporter aucun caractère de retour de ligne et aucun espace blanc de début ou de fin, et doit tenir en une seule phrase sans point final ou en plusieurs phrases avec un point final

Check warning on line 52 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (de-DE)

Die Diagnosemeldung darf keine Zeilenvorschubzeichen und keine führenden oder nachfolgenden Leerzeichen enthalten und muss entweder einen einzelnen Satz ohne Satzendepunkt oder mehrere Sätze mit Satzendepunkt umfassen.

Check warning on line 52 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (pl-PL)

Komunikat dotyczący diagnostyki nie powinien zawierać znaku nowego wiersza ani odstępów na początku i końcu oraz powinien być pojedynczym zdaniem bez kropki na końcu lub wieloma zdaniami z kropkami na końcu

Check warning on line 52 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (ubuntu-latest)

The diagnostic message should not contain any line return character nor any leading or trailing whitespaces and should either be a single sentence without a trailing period or a multi-sentences with a trailing period
category: "TUnit.Assertions.SourceGenerator",
defaultSeverity: DiagnosticSeverity.Error,
isEnabledByDefault: true,
Expand Down Expand Up @@ -895,7 +895,7 @@
// Add null-forgiving operator for reference types if not already present
// This is safe because we've already checked for null above
var isNullable = data.TargetType.IsNullable;
if (isNullable && !string.IsNullOrEmpty(inlinedBody) && !inlinedBody.StartsWith("value!"))

Check warning on line 898 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / integration-tests

Dereference of a possibly null reference.

Check warning on line 898 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (fr-FR)

Déréférencement d'une éventuelle référence null.

Check warning on line 898 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (de-DE)

Dereferenzierung eines möglichen Nullverweises.

Check warning on line 898 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (pl-PL)

Wyłuskanie odwołania, które może mieć wartość null.

Check warning on line 898 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (macos-latest)

Dereference of a possibly null reference.

Check warning on line 898 in TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (ubuntu-latest)

Dereference of a possibly null reference.
{
// Replace null-conditional operators with null-forgiving + regular operators
// value?.Member becomes value!.Member (safe because we already null-checked)
Expand Down Expand Up @@ -1073,7 +1073,7 @@
}

// Include parameter types to distinguish overloads
var paramTypes = string.Join("_", data.AdditionalParameters.Select(p => p.SimpleTypeName));
var paramTypes = string.Join('_', data.AdditionalParameters.Select(p => p.SimpleTypeName));
return $"{targetTypeName}_{methodName}_{paramTypes}_Assertion";
}

Expand Down
2 changes: 1 addition & 1 deletion TUnit.Assertions/Extensions/AssertionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ private static string GetMemberPath<TObject, TMember>(Expression<Func<TObject, T
body = memberExpr.Expression;
}

return parts.Count > 0 ? string.Join(".", parts) : "Unknown";
return parts.Count > 0 ? string.Join('.', parts) : "Unknown";
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion TUnit.Core.SourceGenerator/Extensions/TypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,6 @@ public static string GetNestedClassName(this INamedTypeSymbol typeSymbol)
typeHierarchy.Reverse();

// Join with '+' separator (matching .NET Type.FullName convention for nested types)
return string.Join("+", typeHierarchy);
return string.Join('+', typeHierarchy);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ private static string GetSafeFileName(HookModel hook)
// Only add if there are parameters (matches main branch behavior - no _0_ suffix for empty params)
if (hook.Parameters.Length > 0)
{
var paramTypes = string.Join("_", hook.Parameters.Select(p => SanitizeForFileName(GetSimpleTypeName(p.TypeName))));
var paramTypes = string.Join('_', hook.Parameters.Select(p => SanitizeForFileName(GetSimpleTypeName(p.TypeName))));
baseName += $"__{paramTypes}";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1258,7 +1258,7 @@ private static string GetAssemblyQualifiedTypeName(ITypeSymbol typeSymbol)
}
}

return constraintParts.Count > 0 ? string.Join(" ", constraintParts) : null;
return constraintParts.Count > 0 ? string.Join(' ', constraintParts) : null;
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3604,7 +3604,7 @@ private static string BuildTypeKey(IEnumerable<ITypeSymbol> types)
{
formattedTypes[i] = typesList[i].ToDisplayString(DisplayFormats.FullyQualifiedGenericWithoutGlobalPrefix);
}
return string.Join(",", formattedTypes);
return string.Join(',', formattedTypes);
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion TUnit.Core/Extensions/ReflectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal static string GetFormattedName(this Type type)
return type.Name;
}

var genericArguments = string.Join(",", type.GetGenericArguments().Select(GetFormattedName));
var genericArguments = string.Join(',', type.GetGenericArguments().Select(GetFormattedName));

var backtickIndex = type.Name.IndexOf("`", StringComparison.Ordinal);
if (backtickIndex == -1)
Expand Down
2 changes: 1 addition & 1 deletion TUnit.Core/Extensions/TestContextExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static string GetClassTypeName(this TestContext context)
}

hierarchy.Reverse();
return string.Join("+", hierarchy);
return string.Join('+', hierarchy);
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion TUnit.Core/GenericTestMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public override Func<ExecutableTestCreationContext, TestMetadata, AbstractExecut
{
typeNames[i] = inferredTypes[i].FullName ?? inferredTypes[i].Name;
}
typeKey = string.Join(",", typeNames);
typeKey = string.Join(',', typeNames);

// Find the matching concrete instantiation
if (genericMetadata.ConcreteInstantiations.TryGetValue(typeKey, out var concreteMetadata))
Expand Down
2 changes: 1 addition & 1 deletion TUnit.Engine/Discovery/ReflectionHookDiscoveryService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private static string GetMethodKey(MethodInfo method)
{
paramTypes[i] = parameters[i].ParameterType.FullName ?? "unknown";
}
return $"{m.DeclaringType?.FullName}.{m.Name}({string.Join(",", paramTypes)})";
return $"{m.DeclaringType?.FullName}.{m.Name}({string.Join(',', paramTypes)})";
});
}

Expand Down
2 changes: 1 addition & 1 deletion TUnit.Engine/Services/FilterParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ internal class FilterParser
return filter switch
{
NopFilter => null,
TestNodeUidListFilter testNodeUidListFilter => string.Join(",",
TestNodeUidListFilter testNodeUidListFilter => string.Join(',',
testNodeUidListFilter.TestNodeUids.Select(x => x.Value)),
TreeNodeFilter treeNodeFilter => treeNodeFilter.Filter,
_ => throw new ArgumentOutOfRangeException(nameof(filter))
Expand Down
2 changes: 1 addition & 1 deletion TUnit.Engine/Services/TestFilterService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,6 @@ internal static string GetNestedClassName(ClassMetadata classMetadata)
}

hierarchy.Reverse();
return string.Join("+", hierarchy);
return string.Join('+', hierarchy);
}
}
4 changes: 2 additions & 2 deletions TUnit.Mocks.Http/RequestMatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ internal string Describe()
if (_exactPath != null) parts.Add(_exactPath);
if (_pathPrefix != null) parts.Add($"{_pathPrefix}*");
if (_pathPattern != null) parts.Add($"~/{_pathPattern}/");
if (_requiredHeaders.Count > 0) parts.Add($"headers:{string.Join(",", _requiredHeaders.Keys)}");
if (_requiredHeaders.Count > 0) parts.Add($"headers:{string.Join(',', _requiredHeaders.Keys)}");
if (_bodyContains != null) parts.Add($"body contains \"{_bodyContains}\"");
return parts.Count > 0 ? string.Join(" ", parts) : "*";
return parts.Count > 0 ? string.Join(' ', parts) : "*";
}
}
4 changes: 2 additions & 2 deletions TUnit.Mocks.SourceGenerator/Builders/MockImplBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ private static string FormatConstraintClauses(EquatableArray<MockTypeParameterMo
clauses.Add($"where {tp.Name} : {tp.Constraints}");
}
}
return clauses.Count > 0 ? " " + string.Join(" ", clauses) : "";
return clauses.Count > 0 ? " " + string.Join(' ', clauses) : "";
}

/// <summary>
Expand Down Expand Up @@ -1125,7 +1125,7 @@ public static string GetCompositeSafeName(MockTypeModel model)
var name = model.FullyQualifiedName;
if (model.AdditionalInterfaceNames.Length > 0)
{
name += "_" + string.Join("_", model.AdditionalInterfaceNames);
name += "_" + string.Join('_', model.AdditionalInterfaceNames);
}
return GetSafeName(name);
}
Expand Down
6 changes: 3 additions & 3 deletions TUnit.Mocks.SourceGenerator/Discovery/MemberDiscovery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static (EquatableArray<MockMemberModel> Methods, EquatableArray<MockMembe

case IPropertySymbol indexer when indexer.IsIndexer:
{
var paramTypes = string.Join(",", indexer.Parameters.Select(p => p.Type.GetFullyQualifiedName()));
var paramTypes = string.Join(',', indexer.Parameters.Select(p => p.Type.GetFullyQualifiedName()));
var key = $"I:[{paramTypes}]";
if (seenProperties.TryGetValue(key, out var existingIndex))
{
Expand Down Expand Up @@ -183,7 +183,7 @@ public static (EquatableArray<MockMemberModel> Methods, EquatableArray<MockMembe

case IPropertySymbol indexer when indexer.IsIndexer:
{
var paramTypes = string.Join(",", indexer.Parameters.Select(p => p.Type.GetFullyQualifiedName()));
var paramTypes = string.Join(',', indexer.Parameters.Select(p => p.Type.GetFullyQualifiedName()));
var key = $"I:[{paramTypes}]";
if (seenProperties.TryGetValue(key, out var existingIndex))
{
Expand Down Expand Up @@ -550,7 +550,7 @@ private static string ComputeUnwrappedSmartDefault(ITypeSymbol returnType, bool

private static string GetMethodKey(IMethodSymbol method)
{
var paramTypes = string.Join(",", method.Parameters.Select(p =>
var paramTypes = string.Join(',', method.Parameters.Select(p =>
p.Type.GetFullyQualifiedName() + (p.RefKind != RefKind.None ? "&" : "")));
var typeParams = method.TypeParameters.Length > 0 ? $"`{method.TypeParameters.Length}" : "";
return $"M:{method.Name}{typeParams}({paramTypes})";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ private static string GetMemberKey(ISymbol member)
{
if (member is IMethodSymbol method)
{
var paramTypes = string.Join(",", method.Parameters.Select(p => p.Type.GetFullyQualifiedName() + (p.RefKind != RefKind.None ? "&" : "")));
var paramTypes = string.Join(',', method.Parameters.Select(p => p.Type.GetFullyQualifiedName() + (p.RefKind != RefKind.None ? "&" : "")));
var typeParams = method.TypeParameters.Length > 0 ? $"`{method.TypeParameters.Length}" : "";
return $"M:{method.Name}{typeParams}({paramTypes})";
}
if (member is IPropertySymbol prop)
{
var paramTypes = string.Join(",", prop.Parameters.Select(p => p.Type.GetFullyQualifiedName()));
var paramTypes = string.Join(',', prop.Parameters.Select(p => p.Type.GetFullyQualifiedName()));
return prop.Parameters.Length > 0 ? $"P:{prop.Name}[{paramTypes}]" : $"P:{prop.Name}";
}
if (member is IEventSymbol evt)
Expand Down
2 changes: 1 addition & 1 deletion TUnit.Mocks/Mock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ public static bool TryCreateAutoMock(Type type, MockBehavior behavior, out IMock

private static string GetMultiKey(params Type[] types)
{
return string.Join("|", types.Select(t => t.FullName ?? t.ToString()));
return string.Join('|', types.Select(t => t.FullName ?? t.ToString()));
}

/// <summary>
Expand Down
Loading