Пример #1
0
        public void ReadAllCustomFields()
        {
            var db = new RealDB(connString, new SQL2005DBAnalyzer(connString));

            var desiredColumns = new List<string>(){ "PersonId", "FirstName" };

            var results = db.RawReadAllCustomFields("Person", desiredColumns);

            int actualCount = int.MinValue;
            using (var conn = new SqlConnection(connString))
            {
                actualCount = conn.ExecuteSingleValue<int>("select count(*) from Person");
            }

            //Make sure we get all of the rows in the table
            Assert.AreEqual(results.Count(), actualCount);

            //Make sure we only got the columns we requested rather than entire rows
            Assert.AreEqual(results.First().Keys.ToList(), desiredColumns);
        }