public void FindIndexWithColumnsReturnsTrueWithBadPrimaryKey() { DBObject db = new DBObject(Utility.connMy, "users", "id"); DBRow row = new DBRow(); //Set the columns we want to find row["id"] = 0; //This bad primary key should be ignored. row["first_name"] = "Bob"; //It will still work because we are not checking this column row["last_name"] = "Richards"; //Check that it reports success in finding the index Assert.IsTrue(row.FindIndex(db, new string[] { "last_name" })); //Check that it really did get the index. Assert.AreEqual(1313, row["id"]); }
public void FindIndexTwoColumns() { DBObject db = new DBObject(Utility.connMy, "users", "id"); //Add just the data we want DBRow row = new DBRow(); row["email"] = "*****@*****.**"; row["first_name"] = "Chris"; //Now find the id row.FindIndex(db); Assert.AreEqual(1313, row[db.PrimaryKey]); }
public void FailedFindIndexWithColumnsReturnsFalse() { DBObject db = new DBObject(Utility.connMy, "users", "id"); DBRow row = new DBRow(); //Set the columns we want to find row["first_name"] = "Bob"; //It will still fail because we are checking this column row["last_name"] = "Richards"; //Check that it reports failure in finding the index Assert.IsFalse(row.FindIndex(db, new string[] { "first_name" })); //Check that it really did not get the index. Assert.IsNull(row["id"]); }
public void FindIndexReturnsTrue() { DBObject db = new DBObject(Utility.connMy, "users", "id"); DBRow row = new DBRow(); //Set the columns we want to find row["first_name"] = "Chris"; row["last_name"] = "Richards"; //Check that it reports success in finding the index Assert.IsTrue(row.FindIndex(db)); //Check that it really did get the index. Assert.AreEqual(1313, row["id"]); }
public void FailedFindIndexReturnsFalse() { DBObject db = new DBObject(Utility.connMy, "users", "id"); DBRow row = new DBRow(); //Set the columns we want to find row["first_name"] = "Bob"; row["last_name"] = "JoeJoe"; //Check that it reports failure in finding the index Assert.IsFalse(row.FindIndex(db)); //Check that it really did not get the index. Assert.IsNull(row["id"]); }