Refactor code structure and optimize performance across multiple modules
This commit is contained in:
@@ -8,7 +8,8 @@ namespace StellaOps.Telemetry.Analyzers.Tests;
|
||||
|
||||
public sealed class MetricLabelAnalyzerTests
|
||||
{
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task ValidLabelKey_NoDiagnostic()
|
||||
{
|
||||
var test = """
|
||||
@@ -37,7 +38,8 @@ public sealed class MetricLabelAnalyzerTests
|
||||
await Verifier.VerifyAnalyzerAsync(test);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task InvalidLabelKey_UpperCase_ReportsDiagnostic()
|
||||
{
|
||||
var test = """
|
||||
@@ -70,7 +72,8 @@ public sealed class MetricLabelAnalyzerTests
|
||||
await Verifier.VerifyAnalyzerAsync(test, expected);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task HighCardinalityLabelKey_UserId_ReportsDiagnostic()
|
||||
{
|
||||
var test = """
|
||||
@@ -103,7 +106,8 @@ public sealed class MetricLabelAnalyzerTests
|
||||
await Verifier.VerifyAnalyzerAsync(test, expected);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task HighCardinalityLabelKey_RequestId_ReportsDiagnostic()
|
||||
{
|
||||
var test = """
|
||||
@@ -136,7 +140,8 @@ public sealed class MetricLabelAnalyzerTests
|
||||
await Verifier.VerifyAnalyzerAsync(test, expected);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task HighCardinalityLabelKey_Email_ReportsDiagnostic()
|
||||
{
|
||||
var test = """
|
||||
@@ -169,7 +174,8 @@ public sealed class MetricLabelAnalyzerTests
|
||||
await Verifier.VerifyAnalyzerAsync(test, expected);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task DynamicLabelValue_Variable_ReportsDiagnostic()
|
||||
{
|
||||
var test = """
|
||||
@@ -201,7 +207,8 @@ public sealed class MetricLabelAnalyzerTests
|
||||
await Verifier.VerifyAnalyzerAsync(test, expected);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task DynamicLabelValue_InterpolatedString_ReportsDiagnostic()
|
||||
{
|
||||
var test = """
|
||||
@@ -233,7 +240,8 @@ public sealed class MetricLabelAnalyzerTests
|
||||
await Verifier.VerifyAnalyzerAsync(test, expected);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task StaticLabelValue_Constant_NoDiagnostic()
|
||||
{
|
||||
var test = """
|
||||
@@ -264,7 +272,8 @@ public sealed class MetricLabelAnalyzerTests
|
||||
await Verifier.VerifyAnalyzerAsync(test);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task EnumLabelValue_NoDiagnostic()
|
||||
{
|
||||
var test = """
|
||||
@@ -295,7 +304,8 @@ public sealed class MetricLabelAnalyzerTests
|
||||
await Verifier.VerifyAnalyzerAsync(test);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task EnumToStringLabelValue_NoDiagnostic()
|
||||
{
|
||||
var test = """
|
||||
@@ -326,7 +336,8 @@ public sealed class MetricLabelAnalyzerTests
|
||||
await Verifier.VerifyAnalyzerAsync(test);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task TupleSyntax_ValidLabel_NoDiagnostic()
|
||||
{
|
||||
var test = """
|
||||
@@ -348,7 +359,8 @@ public sealed class MetricLabelAnalyzerTests
|
||||
await Verifier.VerifyAnalyzerAsync(test);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task KeyValuePairCreation_HighCardinalityKey_ReportsDiagnostic()
|
||||
{
|
||||
var test = """
|
||||
@@ -375,7 +387,8 @@ public sealed class MetricLabelAnalyzerTests
|
||||
await Verifier.VerifyAnalyzerAsync(test, expected);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task NonMetricMethod_NoDiagnostic()
|
||||
{
|
||||
var test = """
|
||||
@@ -404,7 +417,8 @@ public sealed class MetricLabelAnalyzerTests
|
||||
await Verifier.VerifyAnalyzerAsync(test);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task MultipleIssues_ReportsAllDiagnostics()
|
||||
{
|
||||
var test = """
|
||||
@@ -442,13 +456,15 @@ public sealed class MetricLabelAnalyzerTests
|
||||
await Verifier.VerifyAnalyzerAsync(test, expected1, expected2);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task StaticReadonlyField_LabelValue_NoDiagnostic()
|
||||
{
|
||||
var test = """
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace TestNamespace
|
||||
{
|
||||
public class GoldenSignalMetrics
|
||||
|
||||
Reference in New Issue
Block a user