FromDocument() public static method

Deprecated. Use the new DBRef(Document) constructor instead.
public static FromDocument ( Document doc ) : DBRef
doc Document
return DBRef
Ejemplo n.º 1
0
        public void TestFromDocument()
        {
            String   colname = "tests";
            String   id      = "32312312";
            Document doc     = new Document().Append(DBRef.RefName, colname).Append(DBRef.IdName, id);

            DBRef expected = new DBRef(colname, id);

            Assert.AreEqual(expected, DBRef.FromDocument(doc));
        }
Ejemplo n.º 2
0
        public void TestFromIncompleteDocumentThrowsArguementException()
        {
            bool thrown = false;

            try {
                DBRef.FromDocument(new Document().Append(DBRef.RefName, "tests"));
            } catch (ArgumentException) {
                thrown = true;
            }
            Assert.IsTrue(thrown, "ArgumentException should have been thrown when trying to create convert from incomplete document");
        }