Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore MethodCollector tests #721

Merged
merged 1 commit into from
Dec 12, 2023
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 @@ -8,7 +8,7 @@ namespace MagicOnion.Client.SourceGenerator.CodeAnalysis;
/// <summary>
/// Provides logic to collect MagicOnion Services and StreamingHubs from a compilation.
/// </summary>
public class MethodCollector
public static class MethodCollector
{
public static (MagicOnionServiceCollection ServiceCollection, IReadOnlyList<Diagnostic> Diagnostics) Collect(ImmutableArray<INamedTypeSymbol> interfaceSymbols, ReferenceSymbols referenceSymbols, CancellationToken cancellationToken)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Microsoft.CodeAnalysis;

namespace MagicOnion.Client.SourceGenerator.Tests.Collector;

public static class MethodCollectorTestHelper
{
public static IEnumerable<INamedTypeSymbol> Traverse(INamespaceOrTypeSymbol rootNamespaceOrTypeSymbol)
{
foreach (var namespaceOrTypeSymbol in rootNamespaceOrTypeSymbol.GetMembers())
{
if (namespaceOrTypeSymbol is INamedTypeSymbol { TypeKind: TypeKind.Interface } typeSymbol)
{
yield return typeSymbol;
}
else if (namespaceOrTypeSymbol is INamespaceSymbol namespaceSymbol)
{
foreach (var t in Traverse(namespaceSymbol))
{
yield return t;
}
}
}
}
}
Loading
Loading