public void AddChildTest()
        {
            var values = new JsonAttribute("chart");
            values.Set(new JsonAttribute("enabled", true));
            string actual = values.ToString();
            string expected = "chart: { enabled: true }";

            HtmlAssert.AreEqual(expected, actual);
        }
        public void AddChildShouldOverrideValue()
        {
            var values = new JsonAttribute("options", false);
            values.Set(new JsonAttribute("enabled", true));
            string actual = values.ToString();
            string expected = "options: { enabled: true }";

            HtmlAssert.AreEqual(expected, actual);
        }
        public void ShouldUseLastChildWhenDuplicated()
        {
            var values = new JsonAttribute("options", false);
            values.Set(new JsonAttribute("enabled", true));
            values.Set(new JsonAttribute("enabled", false));
            string actual = values.ToString();
            string expected = "options: { enabled: false }";

            HtmlAssert.AreEqual(expected, actual);
        }
        public void EmptyKeyWithDuplicatedChild()
        {
            var chart = new JsonAttribute();
            chart.Set(new JsonAttribute("renderTo", "container"));
            chart.Set(new JsonAttribute("renderTo", "new-container"));
            string actual = chart.ToString();
            string expected = "renderTo: 'new-container'";

            HtmlAssert.AreEqual(expected, actual);
        }
        public void EmptyAttributesShouldBeIgnored()
        {
            var values = new JsonAttribute("chart");
            values.Set(new EmptyJsonAttribute());
            string actual = values.ToString();
            string expected = "chart: { }";

            HtmlAssert.AreEqual(expected, actual);
        }
        public void ComplexJsonObjectGraph_WithTwoMainObjects()
        {
            var chart = new JsonAttribute();

            var title = new JsonAttribute("title");
            chart.Set(title);
            title.Set(new JsonAttribute("color", "red"));
            title.Set(new JsonAttribute("size", "16px"));

            var subtitle = new JsonAttribute("subtitle");
            chart.Set(subtitle);
            subtitle.Set(new JsonAttribute("size", "12px"));

            string actual = chart.ToString();
            string expected = @"title: {
                                    color: 'red',
                                    size: '16px'
                                },
                                subtitle: {
                                    size: '12px'
                                }";

            HtmlAssert.AreEqual(expected, actual);
        }