Exemplo n.º 1
0
 public static VirtualValue Map(params object[] keyOrVal)
 {
     Debug.Assert(keyOrVal.Length % 2 == 0);
     string[]   keys   = new string[keyOrVal.Length / 2];
     AnyValue[] values = new AnyValue[keyOrVal.Length / 2];
     for (int i = 0; i < keyOrVal.Length; i += 2)
     {
         keys[i / 2]   = ( string )keyOrVal[i];
         values[i / 2] = ToAnyValue(keyOrVal[i + 1]);
     }
     return(VirtualValues.Map(keys, values));
 }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Parameterized.Parameters(name = "{0}") public static Iterable<WriteTest> data()
        public static IEnumerable <WriteTest> Data()
        {
            return(Arrays.asList(ShouldWrite(VirtualValues.List(booleanValue(false), byteArray(new sbyte[] { 3, 4, 5 }), stringValue("yo")), beginList(3), false, Specials.byteArray(new sbyte[] { 3, 4, 5 }), "yo", endList()), ShouldWrite(VirtualValues.Map(new string[] { "foo", "bar" }, new AnyValue[] { intValue(100), charValue('c') }), beginMap(2), "bar", 'c', "foo", 100, endMap()), ShouldWrite(VirtualValues.Node(1L), writeNodeReference(1L)), ShouldWrite(relationship(2L), writeRelationshipReference(2L)), ShouldWrite(VirtualValues.Path(new NodeValue[] { nodeValue(20L, stringArray("L"), emptyMap()), nodeValue(40L, stringArray("L"), emptyMap()) }, new RelationshipValue[] { relationshipValue(100L, nodeValue(40L, stringArray("L"), emptyMap()), nodeValue(20L, stringArray("L"), emptyMap()), stringValue("T"), emptyMap()) }), writePath(new NodeValue[] { nodeValue(20L, stringArray("L"), emptyMap()), nodeValue(40L, stringArray("L"), emptyMap()) }, new RelationshipValue[] { relationshipValue(100L, nodeValue(40L, stringArray("L"), emptyMap()), nodeValue(20L, stringArray("L"), emptyMap()), stringValue("T"), emptyMap()) })), ShouldWrite(VirtualValues.Map(new string[] { "foo" }, new AnyValue[] { VirtualValues.List(VirtualValues.Map(new string[] { "bar" }, new AnyValue[] { VirtualValues.List() })) }), beginMap(1), "foo", beginList(1), beginMap(1), "bar", beginList(0), endList(), endMap(), endList(), endMap()), ShouldWrite(nodeValue(1337L, stringArray("L1", "L2"), map(new string[] { "foo" }, new AnyValue[] { stringValue("foo") })), writeNode(1337L, stringArray("L1", "L2"), map(new string[] { "foo" }, new AnyValue[] { stringValue("foo") }))), ShouldWrite(relationshipValue(1337L, nodeValue(42L, stringArray("L"), emptyMap()), nodeValue(43L, stringArray("L"), emptyMap()), stringValue("T"), map(new string[] { "foo" }, new AnyValue[] { stringValue("foo") })), writeRelationship(1337L, 42L, 43L, stringValue("T"), map(new string[] { "foo" }, new AnyValue[] { stringValue("foo") })))));
        }