Remove() public method

public Remove ( String key ) : void
key String
return void
 public void TestKeyOrderPreservedOnRemove()
 {
     Document d = new Document();
     d["one"] = 1;
     d["onepointfive"] = 1.5;
     d.Add("two", 2);
     d.Add("two.5", 2.5);
     d.Remove("two.5");
     d["three"] = 3;
     d.Remove("onepointfive");
     int cnt = 1;
     foreach(String key in d.Keys){
         Assert.AreEqual(cnt, d[key]);
         cnt++;
     }
 }
 public void TestRemove()
 {
     Document d = new Document();
     d["one"] = 1;
     d.Remove("one");
     Assert.IsFalse(d.Contains("one"));
 }
        public void TestRemove()
        {
            Document d = new Document();

            d["one"] = 1;
            d.Remove("one");
            Assert.IsFalse(d.Contains("one"));
        }
Esempio n. 4
0
 /// <summary>
 /// TODO Fix any accidental reordering issues.
 /// </summary>
 /// <param name="dest"></param>
 public void CopyTo(Document dest)
 {
     foreach (String key in orderedKeys) {
         if (dest.Contains (key))
             dest.Remove (key);
         dest[key] = this[key];
     }
 }
        public void TestKeyOrderPreservedOnRemove()
        {
            Document d = new Document();

            d["one"]          = 1;
            d["onepointfive"] = 1.5;
            d.Add("two", 2);
            d.Add("two.5", 2.5);
            d.Remove("two.5");
            d["three"] = 3;
            d.Remove("onepointfive");
            int cnt = 1;

            foreach (String key in d.Keys)
            {
                Assert.AreEqual(cnt, d[key]);
                cnt++;
            }
        }
Esempio n. 6
0
 private void AddOrRemoveSpecOpt(string key, Document doc)
 {
     if (doc == null)
     {
         specOpts.Remove(key);
     }
     else
     {
         specOpts[key] = doc;
     }
 }
Esempio n. 7
0
        public void TestIsDocumentDBRef()
        {
            Document doc = new Document();

            Assert.IsFalse(DBRef.IsDocumentDBRef(null));
            Assert.IsFalse(DBRef.IsDocumentDBRef(doc));

            doc[DBRef.RefName] = "tests";
            Assert.IsFalse(DBRef.IsDocumentDBRef(doc));

            doc.Remove(DBRef.RefName);
            doc[DBRef.IdName] = "12312131";
            Assert.IsFalse(DBRef.IsDocumentDBRef(doc));

            doc[DBRef.RefName] = "tests";
            Assert.IsTrue(DBRef.IsDocumentDBRef(doc));
        }
Esempio n. 8
0
        public void TestIsDocumentDBRef()
        {
            Document doc = new Document();

            Assert.IsFalse(DBRef.IsDocumentDBRef(null));
            Assert.IsFalse(DBRef.IsDocumentDBRef(doc));

            doc[DBRef.RefName] = "tests";
            Assert.IsFalse(DBRef.IsDocumentDBRef(doc));

            doc.Remove(DBRef.RefName);
            doc[DBRef.IdName] = "12312131";
            Assert.IsFalse(DBRef.IsDocumentDBRef(doc));

            doc[DBRef.RefName] = "tests";
            Assert.IsTrue(DBRef.IsDocumentDBRef(doc));

            doc[DBRef.MetaName] = new Document();
            Assert.IsTrue(DBRef.IsDocumentDBRef(doc));
        }