コード例 #1
0
        public void WithRegexValueAddsAttributeCorrectly()
        {
            Regex value = new Regex( "Regex" );

            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            var result = builder.Pattern( value );

            Assert.AreSame( builder, result );
            Assert.AreEqual( value.ToString(), builder.Attributes[ HtmlAttributes.Pattern ] );
        }
コード例 #2
0
        public void WithStringValueAddsAttributeCorrectly()
        {
            string value = "Value";

            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            var result = builder.Pattern( value );

            Assert.AreSame( builder, result );
            Assert.AreEqual( value, builder.Attributes[ HtmlAttributes.Pattern ] );
        }
コード例 #3
0
        public void WithNullRegexValueDoesNotAddAttribute()
        {
            Regex value = null;

            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            var result = builder.Pattern( value );

            Assert.AreSame( builder, result );
            Assert.IsFalse( builder.Attributes.ContainsKey( HtmlAttributes.Pattern ) );
        }