Skip to content

Commit 5eb2f3d

Browse files
committed
Filter out compiler-generated types such as RefSafetyRulesAttribute and EmbeddedAttribute.
1 parent d649d7e commit 5eb2f3d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentFilePathIntegrationTest.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#nullable disable
55

66
using System.IO;
7+
using System.Linq;
78
using Xunit;
89

910
namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests;
@@ -24,7 +25,7 @@ public void FileNameIsInvalidClassName_SanitizesInvalidClassName()
2425
// Assert
2526
Assert.Empty(result.Diagnostics);
2627

27-
var type = Assert.Single(result.Assembly.GetTypes());
28+
var type = Assert.Single(result.Assembly.GetTypes().Where(t => t.GetCustomAttributes(inherit: false).All(a => a.GetType().Name != "CompilerGeneratedAttribute")));
2829
Assert.Equal(DefaultRootNamespace, type.Namespace);
2930
Assert.Equal("Filename_with_spaces", type.Name);
3031
}
@@ -44,7 +45,7 @@ public void CreatesClassWithCorrectNameAndNamespace(string relativePath, string
4445
// Assert
4546
Assert.Empty(result.Diagnostics);
4647

47-
var type = Assert.Single(result.Assembly.GetTypes());
48+
var type = Assert.Single(result.Assembly.GetTypes().Where(t => t.GetCustomAttributes(inherit: false).All(a => a.GetType().Name != "CompilerGeneratedAttribute")));
4849
Assert.Equal(expectedNamespace, type.Namespace);
4950
Assert.Equal(expectedClassName, type.Name);
5051
}

0 commit comments

Comments
 (0)