TestSetGetValue6() { // Add random keys and tags for each of N GraphVertexEdgeBase objects. // Create an array of GraphVertexEdgeBase objects and set random keys // and tags on them. const Int32 GraphVertexEdgeBaseObjects = 10000; GraphVertexEdgeBase [] aoGraphVertexEdgeBase = new GraphVertexEdgeBase[GraphVertexEdgeBaseObjects]; for (Int32 i = 0; i < GraphVertexEdgeBaseObjects; i++) { GraphVertexEdgeBase oGraphVertexEdgeBase = aoGraphVertexEdgeBase[i] = new MockGraphVertexEdgeBase(); MetadataUtil.SetRandomMetadata( oGraphVertexEdgeBase, true, true, i); } // Check the values, backwards. for (Int32 i = GraphVertexEdgeBaseObjects - 1; i >= 0; i--) { MetadataUtil.CheckRandomMetadata( aoGraphVertexEdgeBase[i], true, true, i); } }
TestSetGetValue5() { // Add N keys for each of N GraphVertexEdgeBase objects, ask for same // keys in reverse order. // Create an array of keys. const Int32 Keys = 10; String [] asKeys = new String[Keys]; for (Int32 i = 0; i < Keys; i++) { asKeys[i] = Guid.NewGuid().ToString(); } // Create an array of GraphVertexEdgeBase objects. const Int32 GraphVertexEdgeBaseObjects = 10000; GraphVertexEdgeBase [] aoGraphVertexEdgeBase = new GraphVertexEdgeBase[GraphVertexEdgeBaseObjects]; for (Int32 j = 0; j < GraphVertexEdgeBaseObjects; j++) { aoGraphVertexEdgeBase[j] = new MockGraphVertexEdgeBase(); } // Add a value for each key. The value is just the key with appended // indexes. for (Int32 j = 0; j < GraphVertexEdgeBaseObjects; j++) { GraphVertexEdgeBase oGraphVertexEdgeBase = aoGraphVertexEdgeBase[j]; for (Int32 i = 0; i < Keys; i++) { String sKey = asKeys[i]; oGraphVertexEdgeBase.SetValue( sKey, sKey + i.ToString() + j.ToString() ); } } // Retrieve the values. Boolean bContainsKey; for (Int32 j = GraphVertexEdgeBaseObjects - 1; j >= 0; j--) { GraphVertexEdgeBase oGraphVertexEdgeBase = aoGraphVertexEdgeBase[j]; for (Int32 i = Keys - 1; i >= 0; i--) { String sKey = asKeys[i]; bContainsKey = oGraphVertexEdgeBase.ContainsKey(sKey); Assert.IsTrue(bContainsKey); MetadataUtil.TestGetValue( oGraphVertexEdgeBase, sKey, sKey + i.ToString() + j.ToString() ); } // Ask for a non-existent value. bContainsKey = oGraphVertexEdgeBase.ContainsKey("nHnHn"); Assert.IsFalse(bContainsKey); } // Create another GraphVertexEdgeBase object and verify that it // contains no keys. GraphVertexEdgeBase oGraphVertexEdgeBaseNoKeys = new MockGraphVertexEdgeBase(); for (Int32 i = 0; i < Keys; i++) { String sKey = asKeys[i]; bContainsKey = oGraphVertexEdgeBaseNoKeys.ContainsKey(sKey); Assert.IsFalse(bContainsKey); } }