public void InnerHtml_Method()
        {
            Assert.Throws <ArgumentNullException>(() => TagBuilderExtensions.InnerHtml(null, string.Empty));

            var builder = new TagBuilder("tag");

            Assert.True(ReferenceEquals(builder.InnerHtml(string.Empty), builder));
            Assert.Equal(string.Empty, builder.InnerHtml);
            Assert.Equal("html", builder.InnerHtml("html").InnerHtml);
        }
        public void Attribute_Method()
        {
            Assert.Throws <ArgumentNullException>(() => TagBuilderExtensions.Attribute(null, "name", new object()));
            Assert.Throws <ArgumentNullException>(() => new TagBuilder("tag").Attribute(null, new object()));
            Assert.Throws <ArgumentException>(() => new TagBuilder("tag").Attribute(string.Empty, new object()));

            var builder = new TagBuilder("tag");

            Assert.False(builder.Attributes.Any());
            Assert.True(ReferenceEquals(builder.Attribute("attribute", null), builder));
            Assert.False(builder.Attributes.Any());

            var attribute = new object();

            builder.Attribute("attribute", attribute);
            Assert.Equal(1, builder.Attributes.Count);
            Assert.Equal("attribute", builder.Attributes.Single().Key);
            Assert.Equal(attribute.ToString(), builder.Attributes.Single().Value);
        }
        public void Attributes_Method()
        {
            Assert.Throws <ArgumentNullException>(() => TagBuilderExtensions.Attributes(null, new object()));
            Assert.Throws <ArgumentNullException>(() => new TagBuilder("tag").Attributes(null));

            var builder = new TagBuilder("tag");

            Assert.False(builder.Attributes.Any());
            Assert.True(ReferenceEquals(builder.Attributes(new object()), builder));
            Assert.False(builder.Attributes.Any());

            var attributes = new { First = "first", Second = "second" };

            builder.Attributes(attributes);
            Assert.Equal(2, builder.Attributes.Count);
            Assert.Equal("First", builder.Attributes.First().Key);
            Assert.Equal("first", builder.Attributes.First().Value);
            Assert.Equal("Second", builder.Attributes.Last().Key);
            Assert.Equal("second", builder.Attributes.Last().Value);
        }