GetExpectedTextForAttribute() private method

private GetExpectedTextForAttribute ( [ attributeName ) : string
attributeName [
return string
示例#1
0
        protected virtual void VerifyNullabilityFix([NotNull] ParsedSourceCode source,
                                                    [NotNull][ItemNotNull] params string[] messages)
        {
            Guard.NotNull(source, nameof(source));

            AnalyzerTestContext analyzerContext = CreateTestContext(source);

            string fixNotNull   = source.GetExpectedTextForAttribute(NotNullAttributeName);
            string fixCanBeNull = source.GetExpectedTextForAttribute(CanBeNullAttributeName);

            var fixContext = new FixProviderTestContext(analyzerContext, new[] { fixNotNull, fixCanBeNull },
                                                        source.ReIndentExpected);

            AssertDiagnosticsWithCodeFixes(fixContext, messages);
        }
示例#2
0
        protected void VerifyNullabilityFix([NotNull] ParsedSourceCode source)
        {
            Guard.NotNull(source, nameof(source));

            string fixNotNull   = source.GetExpectedTextForAttribute(NotNullAttributeName);
            string fixCanBeNull = source.GetExpectedTextForAttribute(CanBeNullAttributeName);

            AnalyzerTestContext analyzeTextContext = new AnalyzerTestContext(source.GetText(), LanguageNames.CSharp)
                                                     .WithReferences(source.References)
                                                     .WithFileName(source.Filename);
            var fixTestContext = new FixProviderTestContext(analyzeTextContext, new[] { fixNotNull, fixCanBeNull },
                                                            source.ReIndentExpected);

            AssertDiagnosticsWithCodeFixes(fixTestContext);
        }