public async Task Should_trigger_on_generic_struct() { var code = @" using System; using Thinktecture; namespace TestNamespace { [ValueObject] public readonly partial struct {|#0:TestValueObject|}<T> { } }"; var expected = CodeFixVerifier <ThinktectureRuntimeExtensionsAnalyzer, ThinktectureRuntimeExtensionsCodeFixProvider> .Diagnostic(_DIAGNOSTIC_ID).WithLocation(0).WithArguments("Value Object", "TestValueObject<T>"); await CodeFixVerifier <ThinktectureRuntimeExtensionsAnalyzer, ThinktectureRuntimeExtensionsCodeFixProvider> .VerifyAnalyzerAsync(code, new[] { typeof(IEnum <>).Assembly }, expected); }
public async Task Should_trigger_on_generic_struct() { var code = @" using System; using Thinktecture; namespace TestNamespace { public readonly partial struct {|#0:TestEnum|}<T> : IValidatableEnum<string> { public static readonly TestEnum<T> Item1 = default; } }"; var expected = CodeFixVerifier <ThinktectureRuntimeExtensionsAnalyzer, ThinktectureRuntimeExtensionsCodeFixProvider> .Diagnostic(_DIAGNOSTIC_ID).WithLocation(0).WithArguments("Enumeration", "TestEnum<T>"); await CodeFixVerifier <ThinktectureRuntimeExtensionsAnalyzer, ThinktectureRuntimeExtensionsCodeFixProvider> .VerifyAnalyzerAsync(code, new[] { typeof(IEnum <>).Assembly }, expected); }
/// <inheritdoc cref="CodeFixVerifier{TAnalyzer, TCodeFix, TTest, TVerifier}.Diagnostic(DiagnosticDescriptor)"/> public static DiagnosticResult Diagnostic(DiagnosticDescriptor descriptor) => CodeFixVerifier <TAnalyzer, TCodeFix> .Diagnostic(descriptor);
/// <inheritdoc cref="CodeFixVerifier{TAnalyzer, TCodeFix, TTest, TVerifier}.Diagnostic(string)"/> public static DiagnosticResult Diagnostic(string diagnosticId) => CodeFixVerifier <TAnalyzer, TCodeFix> .Diagnostic(diagnosticId);
/// <inheritdoc cref="CodeFixVerifier{TAnalyzer, TCodeFix, TTest, TVerifier}.Diagnostic()"/> public static DiagnosticResult Diagnostic() => CodeFixVerifier <TAnalyzer, TCodeFix> .Diagnostic();
public static DiagnosticResult Diagnostic <TDiagnosticAnalyzer, TCodeFix>(string diagnosticId) where TDiagnosticAnalyzer : DiagnosticAnalyzer, new() where TCodeFix : CodeFixProvider, new() => CodeFixVerifier <TDiagnosticAnalyzer, TCodeFix, CSharpCodeFixTest <TDiagnosticAnalyzer, TCodeFix, XUnitVerifier>, XUnitVerifier> .Diagnostic(diagnosticId);