예제 #1
0
 public void Verify()
 {
     Assert.Equal(JsonValueKind.Number, Number.ValueKind);
     Assert.Equal("1", Number.ToString());
     Assert.Equal(JsonValueKind.True, True.ValueKind);
     Assert.Equal("True", True.ToString());
     Assert.Equal(JsonValueKind.False, False.ValueKind);
     Assert.Equal("False", False.ToString());
     Assert.Equal(JsonValueKind.String, String.ValueKind);
     Assert.Equal("Hello", String.ToString());
     Assert.Equal(JsonValueKind.Array, Array.ValueKind);
     JsonElement[] elements = Array.EnumerateArray().ToArray();
     Assert.Equal(JsonValueKind.Number, elements[0].ValueKind);
     Assert.Equal("2", elements[0].ToString());
     Assert.Equal(JsonValueKind.False, elements[1].ValueKind);
     Assert.Equal("False", elements[1].ToString());
     Assert.Equal(JsonValueKind.True, elements[2].ValueKind);
     Assert.Equal("True", elements[2].ToString());
     Assert.Equal(JsonValueKind.String, elements[3].ValueKind);
     Assert.Equal("Goodbye", elements[3].ToString());
     Assert.Equal(JsonValueKind.Object, Object.ValueKind);
     Assert.Equal("{}", Object.ToString());
     //Assert.Equal(JsonValueKind.Null, Null.ValueKind);
     //Assert.Equal("Null", Null.ToString());
 }
예제 #2
0
        internal override void ToString(StringBuilder sb)
        {
            sb.Append("if ");
            Condition.ToString(sb);
            True.ToString(sb);

            if (False != null)
            {
                sb.Append("else ");
                False.ToString(sb);
            }
        }
예제 #3
0
        internal override void ToString(StringBuilder sb, int ident)
        {
            sb.Append("if ");
            Condition.ToString(sb, 0);
            sb.Append(" then ");
            True.ToString(sb, 0);
            sb.Append(" else ");

            if (False != null)
            {
                False.ToString(sb, 0);
            }
        }
 public override string ToString()
 {
     return(string.Format("({0} ? {1} : {2})", Test.ToString(), True.ToString(), False.ToString()) + "{" + (Value != null ? Value.ToString() : "(null)") + "}");
 }