Ejemplo n.º 1
0
        public void StringPropertyWithNonEmptyPropertyNameAndValue()
        {
            JSONBuilder builder = new JSONBuilder();

            builder.Object(jsonObject =>
            {
                jsonObject.StringProperty("bananas", "apples");
            });
            AssertEx.EqualLines(new[]
            {
                "{",
                "  \"bananas\": \"apples\"",
                "}"
            },
                                builder);
        }
Ejemplo n.º 2
0
        public void StringPropertyWithSingleQuotedPropertyName()
        {
            JSONBuilder builder = new JSONBuilder();

            builder.Object(jsonObject =>
            {
                jsonObject.StringProperty("'bananas'", "apples");
            });
            AssertEx.EqualLines(new[]
            {
                "{",
                "  'bananas': \"apples\"",
                "}"
            },
                                builder);
        }
Ejemplo n.º 3
0
        public void StringPropertyWithNullPropertyName()
        {
            JSONBuilder builder = new JSONBuilder();

            builder.Object(jsonObject =>
            {
                jsonObject.StringProperty(null, "apples");
            });
            AssertEx.EqualLines(new[]
            {
                "{",
                "  \"\": \"apples\"",
                "}"
            },
                                builder);
        }
Ejemplo n.º 4
0
        public void StringPropertyWithNullPropertyValue()
        {
            JSONBuilder builder = new JSONBuilder();

            builder.Object(jsonObject =>
            {
                jsonObject.StringProperty("bananas", null);
            });
            AssertEx.EqualLines(new[]
            {
                "{",
                "  \"bananas\": \"\"",
                "}"
            },
                                builder);
        }
Ejemplo n.º 5
0
        public void StringPropertyWithDoubleQuotedPropertyValueWithForwardSlash()
        {
            JSONBuilder builder = new JSONBuilder();

            builder.Object(jsonObject =>
            {
                jsonObject.StringProperty("bananas", "\"app/les\"");
            });
            AssertEx.EqualLines(new[]
            {
                "{",
                "  \"bananas\": \"app/les\"",
                "}"
            },
                                builder);
        }
Ejemplo n.º 6
0
        public void StringPropertyWithForwardSlashInPropertyName()
        {
            JSONBuilder builder = new JSONBuilder();

            builder.Object(jsonObject =>
            {
                jsonObject.StringProperty("ban/anas", "'apples'");
            });
            AssertEx.EqualLines(new[]
            {
                "{",
                "  \"ban/anas\": 'apples'",
                "}"
            },
                                builder);
        }
Ejemplo n.º 7
0
        public void StringPropertyWithSingleQuotedPropertyValue()
        {
            JSONBuilder builder = new JSONBuilder();

            builder.Object(jsonObject =>
            {
                jsonObject.StringProperty("bananas", "'apples'");
            });
            AssertEx.EqualLines(new[]
            {
                "{",
                "  \"bananas\": 'apples'",
                "}"
            },
                                builder);
        }