|
1 | 1 | // Copyright (c) .NET Foundation. All rights reserved.
|
2 | 2 | // Licensed under the MIT license. See License.txt in the project root for license information.
|
3 | 3 |
|
| 4 | +using System.Runtime.InteropServices; |
4 | 5 | using Microsoft.AspNetCore.Razor.Language;
|
| 6 | +using Microsoft.AspNetCore.Razor.Test.Common; |
5 | 7 | using Microsoft.CodeAnalysis.Razor.Workspaces.Extensions;
|
6 | 8 | using Microsoft.CodeAnalysis.Text;
|
7 | 9 | using Xunit;
|
8 | 10 | using Xunit.Abstractions;
|
9 | 11 |
|
10 | 12 | namespace Microsoft.AspNetCore.Razor.LanguageServer.Test;
|
11 | 13 |
|
12 |
| -public class FindNodeTests |
| 14 | +public class FindNodeTests(ITestOutputHelper testOutput) : ToolingTestBase(testOutput) |
13 | 15 | {
|
14 |
| - private readonly ITestOutputHelper _outputHelper; |
15 |
| - |
16 |
| - public FindNodeTests(ITestOutputHelper outputHelper) |
17 |
| - { |
18 |
| - _outputHelper = outputHelper; |
19 |
| - } |
20 |
| - |
21 |
| - const string FetchDataContents = """ |
| 16 | + private const string FetchDataContents = """ |
22 | 17 | @page "/fetchdata"
|
23 | 18 | @using BlazorApp.Data
|
24 | 19 | @inject WeatherForecastService ForecastService
|
@@ -68,6 +63,10 @@ protected override async Task OnInitializedAsync()
|
68 | 63 | }
|
69 | 64 | """;
|
70 | 65 |
|
| 66 | + private static readonly string s_fetchDataContents = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) |
| 67 | + ? FetchDataContents |
| 68 | + : FetchDataContents.Replace("\n", "\r\n"); |
| 69 | + |
71 | 70 | [Theory]
|
72 | 71 | [InlineData(0, 1, SyntaxKind.CSharpTransition, false)]
|
73 | 72 | [InlineData(0, 1, SyntaxKind.CSharpTransition, true)]
|
@@ -246,7 +245,7 @@ protected override async Task OnInitializedAsync()
|
246 | 245 | [InlineData(944, 1162, SyntaxKind.MarkupTextLiteral, true)]
|
247 | 246 | [InlineData(0, 1162, SyntaxKind.MarkupBlock, false)]
|
248 | 247 | internal void Test_On_FetchData(int start, int end, SyntaxKind kind, bool includeWhitespace)
|
249 |
| - => Verify(FetchDataContents, start, end, kind, includeWhitespace, innermostForTie: true); |
| 248 | + => Verify(s_fetchDataContents, start, end, kind, includeWhitespace, innermostForTie: true); |
250 | 249 |
|
251 | 250 | private static void Verify(string input, int start, int end, SyntaxKind kind, bool includeWhitespace, bool innermostForTie)
|
252 | 251 | {
|
|
0 commit comments