public void Build_DisplayNameIsNameWithDots_NameComparisonPrefixMatch()
        {
            // Arrange
            var builder = new DefaultRequiredAttributeDescriptorBuilder();

            builder
            .Name("asp-route-")
            .NameComparisonMode(RequiredAttributeDescriptor.NameComparisonMode.PrefixMatch);

            // Act
            var descriptor = builder.Build();

            // Assert
            Assert.Equal("asp-route-...", descriptor.DisplayName);
        }
        public void Build_DisplayNameIsName_NameComparisonFullMatch()
        {
            // Arrange
            var builder = new DefaultRequiredAttributeDescriptorBuilder();

            builder
            .Name("asp-action")
            .NameComparisonMode(RequiredAttributeDescriptor.NameComparisonMode.FullMatch);

            // Act
            var descriptor = builder.Build();

            // Assert
            Assert.Equal("asp-action", descriptor.DisplayName);
        }
Пример #3
0
        public void Build_DisplayNameIsNameWithDots_NameComparisonPrefixMatch()
        {
            // Arrange
            var tagHelperBuilder       = new DefaultTagHelperDescriptorBuilder(TagHelperConventions.DefaultKind, "TestTagHelper", "Test");
            var tagMatchingRuleBuilder = new DefaultTagMatchingRuleDescriptorBuilder(tagHelperBuilder);
            var builder = new DefaultRequiredAttributeDescriptorBuilder(tagMatchingRuleBuilder);

            builder
            .Name("asp-route-")
            .NameComparisonMode(RequiredAttributeDescriptor.NameComparisonMode.PrefixMatch);

            // Act
            var descriptor = builder.Build();

            // Assert
            Assert.Equal("asp-route-...", descriptor.DisplayName);
        }