public void AddsAttributeCorrectly()
        {
            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            var result = builder.AutoFocus();

            Assert.AreSame( builder, result );
            Assert.AreEqual( HtmlAttributes.AutoFocus, builder.Attributes[ HtmlAttributes.AutoFocus ] );
        }
        public void AddsAttributeCorrectly()
        {
            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            var result = builder.NoValidate();

            Assert.AreSame( builder, result );
            Assert.AreEqual( HtmlAttributes.NoValidate, builder.Attributes[ HtmlAttributes.NoValidate ] );
        }
        public void AddsAttributeCorrectly()
        {
            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            var result = builder.Translate();

            Assert.AreSame( builder, result );
            Assert.AreEqual( TranslateType.Yes.ToString().ToLower(), builder.Attributes[ HtmlAttributes.Translate ] );
        }
        public void WithFalseDoesNotAddAttribute()
        {
            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            var result = builder.Hidden( false );

            Assert.AreSame( builder, result );
            Assert.IsFalse( builder.Attributes.ContainsKey( HtmlAttributes.Hidden ) );
        }
        public void WithTrueAddsAttributeCorrectly()
        {
            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            var result = builder.Hidden( true );

            Assert.AreSame( builder, result );
            Assert.AreEqual( HtmlAttributes.Hidden, builder.Attributes[ HtmlAttributes.Hidden ] );
        }
        public void WithNullEventAttributeExpressionReturnsCorrectly()
        {
            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            var result = builder.Events( null );

            Assert.AreSame( builder, result );
            Assert.AreEqual( 0, builder.Attributes.Count );
        }
        public void WithFalseRemovesAttributeIfPresent()
        {
            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            var result = builder.FormNoValidate( true ).FormNoValidate( false );

            Assert.AreSame( builder, result );
            Assert.IsFalse( builder.Attributes.ContainsKey( HtmlAttributes.FormNoValidate ) );
        }
        public void AddsAttributeCorrectly()
        {
            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            var result = builder.SpellCheck();

            Assert.AreSame( builder, result );
            Assert.AreEqual( true.ToString().ToLower(), builder.Attributes[ HtmlAttributes.SpellCheck ] );
        }
        public void AddsAttributeCorrectly()
        {
            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            var result = builder.Required();

            Assert.AreSame( builder, result );
            Assert.AreEqual( HtmlAttributes.Required, builder.Attributes[ HtmlAttributes.Required ] );
        }
        public void WithFalseRemovesAttributeIfPresent()
        {
            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            var result = builder.Required( true ).Required( false );

            Assert.AreSame( builder, result );
            Assert.IsFalse( builder.Attributes.ContainsKey( HtmlAttributes.Required ) );
        }
        public void AddsAttributeCorrectly()
        {
            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            var result = builder.Draggable();

            Assert.AreSame( builder, result );
            Assert.AreEqual( DraggableType.True.ToString().ToLower(), builder.Attributes[ HtmlAttributes.Draggable ] );
        }
        public void AddsAttributeCorrectly()
        {
            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();

            var result = builder.Wrap();

            Assert.AreSame( builder, result );
            Assert.AreEqual( WrapType.Hard.ToString().ToLower(), builder.Attributes[ HtmlAttributes.Wrap ] );
        }
        public void WithTargetTypeAddsAttributeCorrectly()
        {
            TargetType value = TargetType.Blank;

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

            Assert.AreSame( builder, result );
            Assert.AreEqual( string.Format( "_{0}", value.ToString().ToLower() ), builder.Attributes[ HtmlAttributes.Target ] );
        }
        public void WithStringAddsAttributeCorrectly()
        {
            string value = "Value";

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

            Assert.AreSame( builder, result );
            Assert.AreEqual( value, builder.Attributes[ HtmlAttributes.Target ] );
        }
        public void WithTrueAddsAttributeCorrectly()
        {
            bool value = true;

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

            Assert.AreSame( builder, result );
            Assert.AreEqual( HtmlAttributes.Required, builder.Attributes[ HtmlAttributes.Required ] );
        }
        public void WithFalseDoesNotAddAttribute()
        {
            bool value = false;

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

            Assert.AreSame( builder, result );
            Assert.IsFalse( builder.Attributes.ContainsKey( HtmlAttributes.Required ) );
        }
        public void WithIntValueAddsAttributeCorrectly()
        {
            int value = 1;

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

            Assert.AreSame( builder, result );
            Assert.AreEqual( value, builder.Attributes[ HtmlAttributes.Min ] );
        }
        public void WithRelTypeValueAddsAttributeCorrectly()
        {
            RelType rel = RelType.Alternate;

            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            var result = builder.Rel( rel );

            Assert.AreSame( builder, result );
            Assert.AreEqual( rel.ToString().ToLower(), builder.Attributes[ HtmlAttributes.Rel ] );
        }
        public void AddsAttributeCorrectly()
        {
            string value = "Value";

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

            Assert.AreSame( builder, result );
            Assert.AreEqual( value, builder.Attributes[ HtmlAttributes.HrefLang ] );
        }
        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 ] );
        }
        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 ) );
        }
        public void WithSpecifiedValueAddsAttributeCorrectly()
        {
            WrapType value = WrapType.Hard;

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

            Assert.AreSame( builder, result );
            Assert.AreEqual( value.ToString().ToLower(), builder.Attributes[ HtmlAttributes.Wrap ] );
        }
        public void WithSpecifiedValueAddsAttributeCorrectly()
        {
            DraggableType value = DraggableType.False;

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

            Assert.AreSame( builder, result );
            Assert.AreEqual( value.ToString().ToLower(), builder.Attributes[ HtmlAttributes.Draggable ] );
        }
        public void AddsAttributeCorrectly()
        {
            string name = "Value";

            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            var result = builder.Name( name );

            Assert.AreSame( builder, result );
            Assert.AreEqual( name, builder.Attributes[ HtmlAttributes.Name ] );
        }
        public void WithDateTimeValueAddsAttributeCorrectly()
        {
            DateTime value = new DateTime( 1 );

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

            Assert.AreSame( builder, result );
            Assert.AreEqual( value.ToString( "yyyy-MM-dd" ), builder.Attributes[ HtmlAttributes.Min ] );
        }
        public void WithSpecifiedValueAddsAttributeCorrectly()
        {
            bool value = false;

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

            Assert.AreSame( builder, result );
            Assert.AreEqual( value.ToString().ToLower(), builder.Attributes[ HtmlAttributes.SpellCheck ] );
        }
        public void NullFalseAttributeExpressionWithConditionFalseReturnsCorrectly()
        {
            bool condition = false;

            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            var result = builder.If( condition, null, null );

            Assert.AreSame( builder, result );
            Assert.IsTrue( builder.Attributes.Count == 0 );
        }
        public void AddsAttributeCorrectly()
        {
            string url = "http://www.example.com";

            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            var result = builder.Src( url );

            Assert.AreSame( builder, result );
            Assert.AreEqual( url, builder.Attributes[ HtmlAttributes.Src ] );
        }
        public void AddsAttributeCorrectly()
        {
            int value = 1;

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

            Assert.AreSame( builder, result );
            Assert.AreEqual( value, builder.Attributes[ HtmlAttributes.Rows ] );
        }
        public void AddsAttributeCorrectly()
        {
            string rel = "Alternate";

            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            var result = builder.Rel( rel );

            Assert.AreSame( builder, result );
            Assert.AreEqual( rel, builder.Attributes[ HtmlAttributes.Rel ] );
        }