コード例 #1
0
 public void WritePropertyNamePrependsPropertyNameWithComaWhenCurrentObjectAlreadyHasProperties()
 {
     using (var stringWriter = new StringWriter(CultureInfo.InvariantCulture))
     {
         var jsonWriter = new TestableJsonWriter(stringWriter);
         jsonWriter.WritePropertyName("Property1");
         jsonWriter.WritePropertyName("Property2");
         Assert.Contains(",\"Property2\"", stringWriter.ToString(), StringComparison.OrdinalIgnoreCase);
     }
 }
コード例 #2
0
 public void WritePropertyNameDoesNotPrependPropertyNameWithComaWhenNewObjectWasStarted()
 {
     using (var stringWriter = new StringWriter(CultureInfo.InvariantCulture))
     {
         var jsonWriter = new TestableJsonWriter(stringWriter);
         jsonWriter.WritePropertyName("Property1");
         jsonWriter.WriteStartObject();
         jsonWriter.WritePropertyName("Property2");
         Assert.Contains("{\"Property2\"", stringWriter.ToString(), StringComparison.OrdinalIgnoreCase);
     }
 }
コード例 #3
0
 public void WritePropertyNameDoesNotPrependPropertyNameWithComaWhenNewObjectWasStarted()
 {
     using (var stringWriter = new StringWriter(CultureInfo.InvariantCulture))
     {
         var jsonWriter = new TestableJsonWriter(stringWriter);
         jsonWriter.WritePropertyName("Property1");
         jsonWriter.WriteStartObject();
         jsonWriter.WritePropertyName("Property2");
         Assert.Contains("{\"Property2\"", stringWriter.ToString(), StringComparison.OrdinalIgnoreCase);
     }
 }
コード例 #4
0
 public void WritePropertyNamePrependsPropertyNameWithComaWhenCurrentObjectAlreadyHasProperties()
 {
     using (var stringWriter = new StringWriter(CultureInfo.InvariantCulture))
     {
         var jsonWriter = new TestableJsonWriter(stringWriter);
         jsonWriter.WritePropertyName("Property1");
         jsonWriter.WritePropertyName("Property2");
         Assert.Contains(",\"Property2\"", stringWriter.ToString(), StringComparison.OrdinalIgnoreCase);
     }
 }