public void StringPropertyWithNonEmptyPropertyNameAndValue() { JSONBuilder builder = new JSONBuilder(); builder.Object(jsonObject => { jsonObject.StringProperty("bananas", "apples"); }); AssertEx.EqualLines(new[] { "{", " \"bananas\": \"apples\"", "}" }, builder); }
public void StringPropertyWithSingleQuotedPropertyName() { JSONBuilder builder = new JSONBuilder(); builder.Object(jsonObject => { jsonObject.StringProperty("'bananas'", "apples"); }); AssertEx.EqualLines(new[] { "{", " 'bananas': \"apples\"", "}" }, builder); }
public void StringPropertyWithNullPropertyName() { JSONBuilder builder = new JSONBuilder(); builder.Object(jsonObject => { jsonObject.StringProperty(null, "apples"); }); AssertEx.EqualLines(new[] { "{", " \"\": \"apples\"", "}" }, builder); }
public void StringPropertyWithNullPropertyValue() { JSONBuilder builder = new JSONBuilder(); builder.Object(jsonObject => { jsonObject.StringProperty("bananas", null); }); AssertEx.EqualLines(new[] { "{", " \"bananas\": \"\"", "}" }, builder); }
public void StringPropertyWithDoubleQuotedPropertyValueWithForwardSlash() { JSONBuilder builder = new JSONBuilder(); builder.Object(jsonObject => { jsonObject.StringProperty("bananas", "\"app/les\""); }); AssertEx.EqualLines(new[] { "{", " \"bananas\": \"app/les\"", "}" }, builder); }
public void StringPropertyWithForwardSlashInPropertyName() { JSONBuilder builder = new JSONBuilder(); builder.Object(jsonObject => { jsonObject.StringProperty("ban/anas", "'apples'"); }); AssertEx.EqualLines(new[] { "{", " \"ban/anas\": 'apples'", "}" }, builder); }
public void StringPropertyWithSingleQuotedPropertyValue() { JSONBuilder builder = new JSONBuilder(); builder.Object(jsonObject => { jsonObject.StringProperty("bananas", "'apples'"); }); AssertEx.EqualLines(new[] { "{", " \"bananas\": 'apples'", "}" }, builder); }