public async Task CollectBaseRules(ProviderCollectingMode providerCollectingMode)
    {
        // Arrange
        var provider = new AsyncFixerProvider(NullLogger.Instance);

        // Act
        var actual = await provider.CollectBaseRules(providerCollectingMode);

        // Assert
        Assert.NotNull(actual);
        Assert.NotNull(actual.Name);
        Assert.Equal(AsyncFixerProvider.Name, actual.Name);
        Assert.NotNull(actual.Rules);
        Assert.True(actual.Rules.Count >= 5);
    }
Esempio n. 2
0
    public async Task <Collection <AnalyzerProviderBaseRuleData> > CollectAllBaseRules(
        ProviderCollectingMode providerCollectingMode,
        bool logWithAnsiConsoleMarkup)
    {
        var data = new Collection <AnalyzerProviderBaseRuleData>();

        var asyncFixerProvider = new AsyncFixerProvider(logger, logWithAnsiConsoleMarkup);
        var asyncFixerTask     = asyncFixerProvider.CollectBaseRules(providerCollectingMode);

        var asyncifyProvider = new AsyncifyProvider(logger, logWithAnsiConsoleMarkup);
        var asyncifyTask     = asyncifyProvider.CollectBaseRules(providerCollectingMode);

        var meziantouProvider = new MeziantouProvider(logger, logWithAnsiConsoleMarkup);
        var meziantouTask     = meziantouProvider.CollectBaseRules(providerCollectingMode);

        var microsoftCodeAnalysisNetAnalyzersProvider = new MicrosoftCodeAnalysisNetAnalyzersProvider(logger, logWithAnsiConsoleMarkup);
        var microsoftCodeAnalysisNetAnalyzersTask     = microsoftCodeAnalysisNetAnalyzersProvider.CollectBaseRules(providerCollectingMode);

        var microsoftCompilerErrorsProvider = new MicrosoftCompilerErrorsProvider(logger, logWithAnsiConsoleMarkup);
        var microsoftCompilerErrorsTask     = microsoftCompilerErrorsProvider.CollectBaseRules(providerCollectingMode);

        var microsoftCodeAnalysisNetAnalyzersProviderUndocumented = new MicrosoftCompilerErrorsProviderUndocumented(logger, logWithAnsiConsoleMarkup);
        var microsoftCompilerErrorsUndocumentedTask = microsoftCodeAnalysisNetAnalyzersProviderUndocumented.CollectBaseRules(ProviderCollectingMode.ReCollect);

        var microsoftVisualStudioThreadingAnalyzersProvider     = new MicrosoftVisualStudioThreadingAnalyzersProvider(logger, logWithAnsiConsoleMarkup);
        var microsoftVisualStudioThreadingAnalyzersProviderTask = microsoftVisualStudioThreadingAnalyzersProvider.CollectBaseRules(ProviderCollectingMode.ReCollect);

        var nSubstituteAnalyzersProvider     = new NSubstituteAnalyzersProvider(logger, logWithAnsiConsoleMarkup);
        var nSubstituteAnalyzersProviderTask = nSubstituteAnalyzersProvider.CollectBaseRules(ProviderCollectingMode.ReCollect);

        var securityCodeScanVs2019Provider = new SecurityCodeScanVs2019Provider(logger, logWithAnsiConsoleMarkup);
        var securityCodeScanVs2019Task     = securityCodeScanVs2019Provider.CollectBaseRules(providerCollectingMode);

        var styleCopAnalyzersProvider = new StyleCopAnalyzersProvider(logger, logWithAnsiConsoleMarkup);
        var styleCopAnalyzersTask     = styleCopAnalyzersProvider.CollectBaseRules(providerCollectingMode);

        var sonarAnalyzerCSharpProvider = new SonarAnalyzerCSharpProvider(logger, logWithAnsiConsoleMarkup);
        var sonarAnalyzerCSharpTask     = sonarAnalyzerCSharpProvider.CollectBaseRules(providerCollectingMode);

        var wpfAnalyzersProvider     = new WpfAnalyzersProvider(logger, logWithAnsiConsoleMarkup);
        var wpfAnalyzersProviderTask = wpfAnalyzersProvider.CollectBaseRules(providerCollectingMode);

        var xunitProvider     = new XunitProvider(logger, logWithAnsiConsoleMarkup);
        var xunitProviderTask = xunitProvider.CollectBaseRules(providerCollectingMode);

        await Task.WhenAll(
            asyncFixerTask,
            asyncifyTask,
            meziantouTask,
            microsoftCodeAnalysisNetAnalyzersTask,
            microsoftCompilerErrorsTask,
            microsoftCompilerErrorsUndocumentedTask,
            microsoftVisualStudioThreadingAnalyzersProviderTask,
            nSubstituteAnalyzersProviderTask,
            securityCodeScanVs2019Task,
            styleCopAnalyzersTask,
            sonarAnalyzerCSharpTask,
            wpfAnalyzersProviderTask,
            xunitProviderTask);

        data.Add(await asyncFixerTask);
        data.Add(await asyncifyTask);
        data.Add(await meziantouTask);
        data.Add(await microsoftCodeAnalysisNetAnalyzersTask);
        data.Add(await microsoftCompilerErrorsTask);
        data.Add(await microsoftCompilerErrorsUndocumentedTask);
        data.Add(await microsoftVisualStudioThreadingAnalyzersProviderTask);
        data.Add(await nSubstituteAnalyzersProviderTask);
        data.Add(await securityCodeScanVs2019Task);
        data.Add(await styleCopAnalyzersTask);
        data.Add(await sonarAnalyzerCSharpTask);
        data.Add(await wpfAnalyzersProviderTask);
        data.Add(await xunitProviderTask);

        return(data);
    }