示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
 /// <inheritdoc cref="CodeFixVerifier{TAnalyzer, TCodeFix, TTest, TVerifier}.Diagnostic(DiagnosticDescriptor)"/>
 public static DiagnosticResult Diagnostic(DiagnosticDescriptor descriptor)
 => CodeFixVerifier <TAnalyzer, TCodeFix> .Diagnostic(descriptor);
示例#4
0
 /// <inheritdoc cref="CodeFixVerifier{TAnalyzer, TCodeFix, TTest, TVerifier}.Diagnostic(string)"/>
 public static DiagnosticResult Diagnostic(string diagnosticId)
 => CodeFixVerifier <TAnalyzer, TCodeFix> .Diagnostic(diagnosticId);
示例#5
0
 /// <inheritdoc cref="CodeFixVerifier{TAnalyzer, TCodeFix, TTest, TVerifier}.Diagnostic()"/>
 public static DiagnosticResult Diagnostic()
 => CodeFixVerifier <TAnalyzer, TCodeFix> .Diagnostic();
示例#6
0
 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);