public void Add_new_attribute()
        {
            var h = new HtmlAttributes(href => "http://url/");

            h.Attr("data-value", "val");

            Assert.That(h.ToHtmlString(), Is.EqualTo(" data-value=\"val\" href=\"http://url/\""));
        }
        public void Add_css_classes()
        {
            var h = new HtmlAttributes(@class => "class1");

            h.AddClass("class2 class3");

            Assert.That(h.ToHtmlString(), Is.EqualTo(" class=\"class2 class3 class1\""));
        }
        public void Replace_existing_attribute()
        {
            var h = new HtmlAttributes(href => "http://url/");

            h.Attr("href", "newhref");

            Assert.That(h.ToHtmlString(), Is.EqualTo(" href=\"newhref\""));
        }
        public void Construct_via_anonymous_object()
        {
            var h = new HtmlAttributes(AnonymousObject);

            Assert.That(h.ToHtmlString(), Is.EqualTo(ExpectedHtml));
        }
        public void Construct_via_dictionary()
        {
            var h = new HtmlAttributes(Dictionary);

            Assert.That(h.ToHtmlString(), Is.EqualTo(ExpectedHtml));
        }
        public void Construct_via_lambdas()
        {
            var h = new HtmlAttributes(style => "width: 100%;", cellpadding => 0, @class => "class1 class2", src => "http://url/", data_somedata => "\"rubbi&h\"");

            Assert.That(h.ToHtmlString(), Is.EqualTo(ExpectedHtml));
        }
        public void Replace_and_add_attributes_using_anonymous_object()
        {
            var h = new HtmlAttributes(data_existing => "old");

            h.Attrs(new {data_existing = "new", data_new = "newnew"});

            Assert.That(h.ToHtmlString(), Is.EqualTo(" data-existing=\"new\" data-new=\"newnew\""));
        }
        public void Replace_and_add_attributes_using_dictionary()
        {
            var h = new HtmlAttributes(data_existing => "old");

            h.Attrs(new Dictionary<string, object> {{"data-existing", "new"}, {"data-new", "newnew"}});

            Assert.That(h.ToHtmlString(), Is.EqualTo(" data-existing=\"new\" data-new=\"newnew\""));
        }
        public void Replace_and_add_attributes_using_lambdas()
        {
            var h = new HtmlAttributes(data_existing => "old");

            h.Attrs(data_existing => "new", data_new => "newnew");

            Assert.That(h.ToHtmlString(), Is.EqualTo(" data-existing=\"new\" data-new=\"newnew\""));
        }