public void NullClassesReturnsCorrectly()
        {
            string[] classes = null;

            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            var result = builder.AddClass( @classes );

            Assert.AreSame( builder, result );
            Assert.IsFalse( builder.Attributes.ContainsKey( HtmlAttributes.Class ) );
        }
        public void RemovingLastClassRemovesAttributeCorrectly()
        {
            string class1 = "Class1";

            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            var result = builder.AddClass( class1 ).RemoveClass( class1 );

            Assert.AreSame( builder, result );
            Assert.IsFalse( builder.Attributes.ContainsKey( HtmlAttributes.Class ) );
        }
        public void AddsAttributeCorrectly()
        {
            string @class = "class";

            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            var result = builder.AddClass( @class );

            Assert.AreSame( builder, result );

            AttributeValueCollection attributeValues = builder.Attributes[ HtmlAttributes.Class ] as AttributeValueCollection;

            Assert.IsNotNull( attributeValues );
            Assert.AreEqual( @class, attributeValues[ 0 ] );
        }
        public void RemovesClassCorrectly()
        {
            string class1 = "Class1";
            string class2 = "Class2";

            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            var result = builder.AddClass( class1, class2 ).RemoveClass( class1 );

            Assert.AreSame( builder, result );

            AttributeValueCollection attributeValues = builder.Attributes[ HtmlAttributes.Class ] as AttributeValueCollection;

            Assert.IsNotNull( attributeValues );
            Assert.AreEqual( 1, attributeValues.Count );
            Assert.AreEqual( class2, attributeValues[ 0 ] );
        }
        public void WithMultipleClassesAddsAttributeCorrectly()
        {
            string[] classes = new string[]
            {
                "Class1",
                "Class2"
            };

            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            var result = builder.AddClass( classes );

            Assert.AreSame( builder, result );

            AttributeValueCollection attributeValues = builder.Attributes[ HtmlAttributes.Class ] as AttributeValueCollection;

            Assert.IsNotNull( attributeValues );
            CollectionAssert.AreEquivalent( classes, attributeValues );
        }