public void Create_UnknownVersion_Throws() { // Arrange, Act & Assert var exception = Assert.Throws <ArgumentException>( () => RazorParserFeatureFlags.Create(0)); Assert.Equal("Provided value for razor language version is unsupported or invalid: '0'.", exception.Message); }
public void Create_OlderVersion_DoesNotAllowMinimizedBooleanTagHelperAttributes() { // Arrange & Act var context = RazorParserFeatureFlags.Create(RazorLanguageVersion.Version1_1); // Assert Assert.False(context.AllowMinimizedBooleanTagHelperAttributes); }
public void Create_LatestVersion_AllowsMinimizedBooleanTagHelperAttributes() { // Arrange & Act var context = RazorParserFeatureFlags.Create(RazorLanguageVersion.Version2_1); // Assert Assert.True(context.AllowMinimizedBooleanTagHelperAttributes); }
public void Create_21Version_Allows21Features() { // Arrange & Act var context = RazorParserFeatureFlags.Create(RazorLanguageVersion.Version_2_1, FileKinds.Legacy); // Assert Assert.True(context.AllowMinimizedBooleanTagHelperAttributes); Assert.True(context.AllowHtmlCommentsInTagHelpers); }
public void Create_LatestVersion_AllowsLatestFeatures() { // Arrange & Act var context = RazorParserFeatureFlags.Create(RazorLanguageVersion.Latest, FileKinds.Legacy); // Assert Assert.True(context.AllowComponentFileKind); Assert.True(context.AllowRazorInAllCodeBlocks); Assert.True(context.AllowUsingVariableDeclarations); Assert.True(context.AllowNullableForgivenessOperator); }
public void Create_OldestVersion_DoesNotAllowLatestFeatures() { // Arrange & Act var context = RazorParserFeatureFlags.Create(RazorLanguageVersion.Version_1_0, FileKinds.Legacy); // Assert Assert.False(context.AllowMinimizedBooleanTagHelperAttributes); Assert.False(context.AllowHtmlCommentsInTagHelpers); Assert.False(context.AllowComponentFileKind); Assert.False(context.AllowRazorInAllCodeBlocks); Assert.False(context.AllowUsingVariableDeclarations); Assert.False(context.AllowNullableForgivenessOperator); }
public DefaultRazorParserOptions(DirectiveDescriptor[] directives, bool designTime, bool parseLeadingDirectives, RazorLanguageVersion version) { if (directives == null) { throw new ArgumentNullException(nameof(directives)); } Directives = directives; DesignTime = designTime; ParseLeadingDirectives = parseLeadingDirectives; Version = version; FeatureFlags = RazorParserFeatureFlags.Create(Version); }