@@ -197,23 +197,22 @@ Task FooAsync()
197
197
""" ;
198
198
TestFileMarkupParser . GetPosition ( input , out var documentContent , out _ ) ;
199
199
var originalSourceText = SourceText . From ( documentContent ) ;
200
- var expectedSourceText = SourceText . From (
201
- """
200
+ var expected = """
202
201
@{
203
202
async Task FooAsync()
204
203
{
205
204
await
206
205
}
207
206
}
208
- """ ) ;
207
+ """ ;
209
208
210
209
// Act
211
210
var resolvedItem = await ResolveCompletionItemAsync ( input , itemToResolve : "await" , supportsVisualStudioExtensions : true , DisposalToken ) ;
212
211
213
212
// Assert
214
213
var textChange = originalSourceText . GetTextChange ( resolvedItem . TextEdit . Value . First ) ;
215
214
var actualSourceText = originalSourceText . WithChanges ( textChange ) ;
216
- Assert . True ( expectedSourceText . ContentEquals ( actualSourceText ) ) ;
215
+ AssertEx . EqualOrDiff ( expected , actualSourceText . ToString ( ) ) ;
217
216
}
218
217
219
218
[ Fact ]
@@ -232,16 +231,15 @@ Task FooAsync()
232
231
233
232
// Admittedly the result here is not perfect, but only because our tests don't implement the full LSP editor logic. The key thing
234
233
// is the addition of the using directive.
235
- var expectedSourceText = SourceText . From (
236
- """
234
+ var expected = """
237
235
@using System.Text
238
236
@{
239
237
Task FooAsync()
240
238
{
241
239
String
242
240
}
243
241
}
244
- """ ) ;
242
+ """ ;
245
243
246
244
var codeDocument = CreateCodeDocument ( input . Text , filePath : "C:/path/to/file.razor" ) ;
247
245
// Roslyn won't send unimported types if SupportsVisualStudioExtensions is true
@@ -275,7 +273,7 @@ Task FooAsync()
275
273
var originalSourceText = SourceText . From ( input . Text ) ;
276
274
var textChange = originalSourceText . GetTextChange ( resolvedItem . AdditionalTextEdits . Single ( ) ) ;
277
275
var actualSourceText = originalSourceText . WithChanges ( textChange ) ;
278
- AssertEx . EqualOrDiff ( expectedSourceText . ToString ( ) , actualSourceText . ToString ( ) ) ;
276
+ AssertEx . EqualOrDiff ( expected , actualSourceText . ToString ( ) ) ;
279
277
}
280
278
281
279
[ Fact ]
@@ -290,23 +288,22 @@ public async Task ResolveAsync_CSharp_OverrideCompletion()
290
288
""" ;
291
289
TestFileMarkupParser . GetPosition ( input , out var documentContent , out _ ) ;
292
290
var originalSourceText = SourceText . From ( documentContent ) ;
293
- var expectedSourceText = SourceText . From (
294
- """
291
+ var expected = """
295
292
@using System.Threading.Tasks
296
293
@code {
297
294
protected override Task OnInitializedAsync()
298
295
{
299
296
return base.OnInitializedAsync();
300
297
}
301
298
}
302
- """ ) ;
299
+ """ ;
303
300
304
301
// Act
305
302
var resolvedItem = await ResolveCompletionItemAsync ( input , itemToResolve : "OnInitializedAsync()" , supportsVisualStudioExtensions : false , DisposalToken ) ;
306
303
307
304
var textChange = originalSourceText . GetTextChange ( ( TextEdit ) resolvedItem . Command . Arguments [ 1 ] ) ;
308
305
var actualSourceText = originalSourceText . WithChanges ( textChange ) ;
309
- AssertEx . EqualOrDiff ( expectedSourceText . ToString ( ) , actualSourceText . ToString ( ) ) ;
306
+ AssertEx . EqualOrDiff ( expected , actualSourceText . ToString ( ) ) ;
310
307
}
311
308
312
309
[ Fact ]
0 commit comments