diff --git a/src/Framework/AspNetCoreAnalyzers/test/Http/HeaderDictionaryAddTest.cs b/src/Framework/AspNetCoreAnalyzers/test/Http/HeaderDictionaryAddTest.cs index 5eaa129e66fe..13684257b8b8 100644 --- a/src/Framework/AspNetCoreAnalyzers/test/Http/HeaderDictionaryAddTest.cs +++ b/src/Framework/AspNetCoreAnalyzers/test/Http/HeaderDictionaryAddTest.cs @@ -147,22 +147,25 @@ public static IEnumerable FixedWithAppendAddsUsingDirectiveTestData() }; } - [ConditionalTheory] - [OSSkipCondition(OperatingSystems.Linux)] - [OSSkipCondition(OperatingSystems.MacOSX)] + [Theory] [MemberData(nameof(FixedWithAppendAddsUsingDirectiveTestData))] public async Task IHeaderDictionary_WithAdd_FixedWithAppend_AddsUsingDirective(string source, string fixedSource) { + // Source is cloned on Windows with CRLF line endings, then the test is run by Helix in Windows/Linux/macOS. + // When Roslyn adds a new `using`, it gets added followed by Environment.NewLine. + // For Linux/macOS, the actual result is `\n`, however, the source is cloned on Windows with CRLF expectation. + // We replace all line endings with Environment.NewLine to avoid this. + // Arrange & Act & Assert await VerifyCS.VerifyCodeFixAsync( - source.TrimStart(), + source.TrimStart().ReplaceLineEndings(), new[] { new DiagnosticResult(DiagnosticDescriptors.DoNotUseIHeaderDictionaryAdd) .WithLocation(0) .WithMessage(Resources.Analyzer_HeaderDictionaryAdd_Message) }, - fixedSource.TrimStart(), + fixedSource.TrimStart().ReplaceLineEndings(), codeActionEquivalenceKey: AppendCodeActionEquivalenceKey); }