Пример #1
0
        public void WithNullNameDoesNotAddAttribute()
        {
            string name = null;
            string value = "Value";

            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            var result = builder.Data( name, value );

            Assert.AreSame( builder, result );
            Assert.AreEqual( 0, builder.Attributes.Count );
        }
Пример #2
0
        public void WithWhiteSpaceNameDoesNotAddAttribute()
        {
            string name = " ";
            string value = "Value";

            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            var result = builder.Data( name, value );

            string expectedAttributeName = string.Format( "data-{0}", name );

            Assert.AreSame( builder, result );
            Assert.IsFalse( builder.Attributes.ContainsKey( expectedAttributeName ) );
        }
Пример #3
0
        public void AddsAttributeCorrectly()
        {
            string name = "Name";
            string value = "Value";

            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            var result = builder.Data( name, value );

            string expectedAttributeName = string.Format( "data-{0}", name );

            Assert.AreSame( builder, result );
            Assert.AreEqual( value, builder.Attributes[ expectedAttributeName ] );
        }