Example #1
0
        public void WritePropertyWithNullWriter()
        {
            JsonTextWriter writer        = null;
            const string   propertyName  = "mockPropertyName";
            const string   propertyValue = "mockPropertyValue";

            Assert.Throws <ArgumentNullException>(() => { ResourceSchemaWriter.WriteProperty(writer, propertyName, propertyValue); });
        }
Example #2
0
        public void WritePropertyWithNullPropertyName()
        {
            StringWriter   stringWriter = new StringWriter();
            JsonTextWriter writer       = new JsonTextWriter(stringWriter);

            writer.QuoteChar = '\'';

            const string propertyName  = null;
            const string propertyValue = "mockPropertyValue";

            Assert.Throws <ArgumentException>(() => { ResourceSchemaWriter.WriteProperty(writer, propertyName, propertyValue); });
        }
Example #3
0
        public void WritePropertyWithNonWhitespacePropertyValue()
        {
            StringWriter   stringWriter = new StringWriter();
            JsonTextWriter writer       = new JsonTextWriter(stringWriter);

            writer.QuoteChar = '\'';

            const string propertyName  = "mockPropertyName";
            const string propertyValue = "mockPropertyValue";

            ResourceSchemaWriter.WriteProperty(writer, propertyName, propertyValue);

            Assert.Equal("'mockPropertyName':'mockPropertyValue'", stringWriter.ToString());
        }