public void TestStyleEmptyStyleAttr()
    {
        CssXmlElement       elm = getElm("<a style='' />", "", "a") as CssXmlElement;
        CssStyleDeclaration csd = (CssStyleDeclaration)elm.Style;

        Assert.AreEqual("", csd.CssText);
        Assert.AreEqual(0, csd.Length);
        Assert.AreEqual(CssStyleSheetType.Inline, csd.Origin);
    }
    public void TestStyleCreate()
    {
        CssXmlElement elm = getElm("<a />", "", "a") as CssXmlElement;

        Assert.AreEqual("", elm.Style.CssText);

        elm.SetAttribute("style", "run:ar");
        Assert.AreEqual("run:ar;", elm.Style.CssText);
    }
    public void TestStyleRemove()
    {
        CssXmlElement elm = getElm("<a style='foo:bar' />", "", "a") as CssXmlElement;

        Assert.AreEqual("foo:bar;", elm.Style.CssText);

        elm.RemoveAttribute("style");
        Assert.AreEqual("", elm.Style.CssText);
    }
    public void TestStyleSingle()
    {
        CssXmlElement       elm = getElm("<a style='foo:bar' />", "", "a") as CssXmlElement;
        CssStyleDeclaration csd = (CssStyleDeclaration)elm.Style;

        Assert.AreEqual("foo:bar;", csd.CssText);
        Assert.AreEqual(1, csd.Length);
        Assert.AreEqual("foo", csd[0]);
        Assert.AreEqual("bar", csd.GetPropertyValue("foo"));
        Assert.AreEqual(CssStyleSheetType.Inline, csd.Origin);
    }
    public void TestStyleMultipleWithSame()
    {
        CssXmlElement        elm = getElm("<a style='foo:bar; kalle:roffe;foo:newvalue' />", "", "a") as CssXmlElement;
        ICssStyleDeclaration csd = elm.Style;

        if (!csd.CssText.Equals("kalle:roffe;foo:newvalue;") &&
            !csd.CssText.Equals("foo:newvalue;kalle:roffe;"))
        {
            Assert.Fail();
        }
        Assert.AreEqual(2, csd.Length);
        Assert.AreEqual("newvalue", csd.GetPropertyValue("foo"));
    }
    public void TestStyleMultiple()
    {
        CssXmlElement       elm = getElm("<a style='foo:bar; kalle:roffe' />", "", "a") as CssXmlElement;
        CssStyleDeclaration csd = (CssStyleDeclaration)elm.Style;

        if (!csd.CssText.Equals("foo:bar;kalle:roffe;") &&
            !csd.CssText.Equals("kalle:roffe;foo:bar;"))
        {
            Assert.Fail();
        }
        Assert.AreEqual(2, csd.Length);
        Assert.AreEqual("bar", csd.GetPropertyValue("foo"));
        Assert.AreEqual("roffe", csd.GetPropertyValue("kalle"));
        Assert.AreEqual(CssStyleSheetType.Inline, csd.Origin);
    }