示例#1
0
文件: Class1.cs 项目: ripter/DBObject
        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"]);
        }
示例#2
0
文件: Class1.cs 项目: ripter/DBObject
        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]);
        }
示例#3
0
文件: Class1.cs 项目: ripter/DBObject
        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"]);
        }
示例#4
0
文件: Class1.cs 项目: ripter/DBObject
        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"]);
        }
示例#5
0
文件: Class1.cs 项目: ripter/DBObject
        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"]);
        }