public void FillFromIndexKeepsNonNullValues() { DBObject db = new DBObject(Utility.connMy, "users", "id"); //Add just the data we want DBRow row = new DBRow(); row[db.PrimaryKey] = 1313; row["email"] = "*****@*****.**"; //Fill from the ID row.FillFromIndex(db, true); Assert.AreEqual("Chris", row["first_name"]); Assert.AreEqual("Richards", row["last_name"]); //Check that it kept out value. Assert.AreEqual("*****@*****.**", row["email"]); }
public void FillFromIndexOverwritesColumns() { DBObject db = new DBObject(Utility.connMy, "users", "id"); //Add just the data we want DBRow row = new DBRow(); row[db.PrimaryKey] = 1313; row["email"] = "*****@*****.**"; //It should overwrite this value with the one from the database. //Fill from the ID row.FillFromIndex(db); Assert.AreEqual("Chris", row["first_name"]); Assert.AreEqual("Richards", row["last_name"]); //Check that our email was replaced with the one in the database. Assert.AreEqual("*****@*****.**", row["email"]); }
public void FillFromIndex() { DBObject db = new DBObject(Utility.connMy, "users", "id"); //Add just the data we want DBRow row = new DBRow(); row[db.PrimaryKey] = 1313; //Fill from the ID row.FillFromIndex(db); Assert.AreEqual("*****@*****.**", row["email"]); }