CopyTo() public method

TODO Fix any accidental reordering issues.
public CopyTo ( Document dest ) : void
dest Document
return void
Example #1
0
 public void TestCopyToCopiesAndOverwritesKeys()
 {
     Document d = new Document();
     Document dest = new Document();
     dest["two"] = 200;
     d["one"] = 1;
     d.Add("two", 2);
     d["three"] = 3;
     d.CopyTo(dest);
     Assert.AreEqual(2, dest["two"]);
 }
        public void TestCopyToCopiesAndOverwritesKeys()
        {
            Document d    = new Document();
            Document dest = new Document();

            dest["two"] = 200;
            d["one"]    = 1;
            d.Add("two", 2);
            d["three"] = 3;
            d.CopyTo(dest);
            Assert.AreEqual(2, dest["two"]);
        }
 public void TestCopyToCopiesAndPreservesKeyOrderToEmptyDoc()
 {
     Document d = new Document();
     Document dest = new Document();
     d["one"] = 1;
     d.Add("two", 2);
     d["three"] = 3;
     d.CopyTo(dest);
     int cnt = 1;
     foreach(String key in dest.Keys){
         Assert.AreEqual(cnt, d[key]);
         cnt++;
     }
 }
        public void TestCopyToCopiesAndPreservesKeyOrderToEmptyDoc()
        {
            Document d    = new Document();
            Document dest = new Document();

            d["one"] = 1;
            d.Add("two", 2);
            d["three"] = 3;
            d.CopyTo(dest);
            int cnt = 1;

            foreach (String key in dest.Keys)
            {
                Assert.AreEqual(cnt, d[key]);
                cnt++;
            }
        }
Example #5
0
 static void DoBulkInsert(Database db, string col, Document doc, int size)
 {
     for(int i = 0; i < perTrial / size; i++){
         Document[] docs = new Document[size];
         for(int f = 0; f < docs.Length; f++){
             Document ins = new Document();
             doc.CopyTo(ins);
             docs[f] = ins;
         }
         db[col].Insert(docs);
     }
 }
Example #6
0
 static void DoInsert(Database db, string col, Document doc)
 {
     for(int i = 0; i < perTrial; i++){
         Document ins = new Document();
         doc.CopyTo(ins);
         ins.Append("x", i);
         db[col].Insert(ins);
     }
 }