File tree 2 files changed +26
-9
lines changed
src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests 2 files changed +26
-9
lines changed Original file line number Diff line number Diff line change 10
10
using Microsoft . AspNetCore . Mvc . Razor . Extensions ;
11
11
using Microsoft . AspNetCore . Razor . Test . Common ;
12
12
using Microsoft . CodeAnalysis ;
13
+ using Microsoft . CodeAnalysis . CSharp ;
14
+ using Microsoft . CodeAnalysis . Test . Utilities ;
13
15
using Roslyn . Test . Utilities ;
14
16
15
17
namespace Microsoft . AspNetCore . Razor . Language . IntegrationTests ;
@@ -22,8 +24,15 @@ public CodeGenerationIntegrationTest(bool designTime = false)
22
24
: base ( layer : TestProject . Layer . Compiler )
23
25
{
24
26
this . designTime = designTime ;
25
- BaseCompilation = BaseCompilation . AddReferences (
26
- MetadataReference . CreateFromFile ( typeof ( TestTagHelperDescriptors ) . Assembly . Location ) ) ;
27
+ var testTagHelpers = CSharpCompilation . Create (
28
+ assemblyName : "Microsoft.AspNetCore.Razor.Language.Test" ,
29
+ syntaxTrees :
30
+ [
31
+ CSharpSyntaxTree . ParseText ( TestTagHelperDescriptors . Code ) ,
32
+ ] ,
33
+ references : ReferenceUtil . AspNetLatestAll ,
34
+ options : new CSharpCompilationOptions ( OutputKind . DynamicallyLinkedLibrary ) ) ;
35
+ BaseCompilation = BaseCompilation . AddReferences ( testTagHelpers . VerifyDiagnostics ( ) . EmitToImageReference ( ) ) ;
27
36
}
28
37
29
38
[ IntegrationTestFact ]
Original file line number Diff line number Diff line change @@ -215,7 +215,7 @@ public static IEnumerable<TagHelperDescriptor> EnumTagHelperDescriptors
215
215
. Name ( "catch-all" )
216
216
. Metadata ( PropertyName ( "CatchAll" ) )
217
217
. AsEnum ( )
218
- . TypeName ( $ " { typeof ( TestTagHelperDescriptors ) . FullName } . { nameof ( MyEnum ) } ") ,
218
+ . TypeName ( "Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestTagHelperDescriptors. MyEnum") ,
219
219
} ) ,
220
220
CreateTagHelperDescriptor (
221
221
tagName : "input" ,
@@ -227,7 +227,7 @@ public static IEnumerable<TagHelperDescriptor> EnumTagHelperDescriptors
227
227
. Name ( "value" )
228
228
. Metadata ( PropertyName ( "Value" ) )
229
229
. AsEnum ( )
230
- . TypeName ( $ " { typeof ( TestTagHelperDescriptors ) . FullName } . { nameof ( MyEnum ) } ") ,
230
+ . TypeName ( "Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestTagHelperDescriptors. MyEnum") ,
231
231
} ) ,
232
232
} ;
233
233
}
@@ -644,9 +644,17 @@ private class TestType
644
644
public string BoundProperty { get ; set ; }
645
645
}
646
646
647
- public enum MyEnum
648
- {
649
- MyValue ,
650
- MySecondValue
651
- }
647
+ public static readonly string Code = """
648
+ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
649
+ {
650
+ public class TestTagHelperDescriptors
651
+ {
652
+ public enum MyEnum
653
+ {
654
+ MyValue,
655
+ MySecondValue
656
+ }
657
+ }
658
+ }
659
+ """ ;
652
660
}
You can’t perform that action at this time.
0 commit comments