Пример #1
0
        public void SmokeTest()
        {
            var sql = new ExpandoSql(connectionString);

            sql.EachRow("select * from Customers order by CustomerID",
                r => Console.WriteLine("{0} - {1}", r.CompanyName, r.ContactName));
        }
Пример #2
0
        public void ShouldPerformActionToFirstRow()
        {
            var sql = new ExpandoSql(connectionString);

            string firstCustomer = "";

            sql.FirstRow("select * from Customers order by CustomerID",
                r => firstCustomer = r.CustomerID);

            Assert.AreEqual("ALFKI", firstCustomer);
        }
Пример #3
0
        public void ShouldPerformActionToEachRow()
        {
            var sql = new ExpandoSql(connectionString);

            sql.EachRow("select * from Customers order by CustomerID",
                r => Console.WriteLine("{0} - {1}", r.CompanyName, r.ContactName));

            decimal total = 0.0m;

            sql.EachRow("select * from [Order Details] where OrderID = 10251",
                r => total += r.Quantity * r.UnitPrice * (decimal)(1 - r.Discount));

            Assert.AreEqual(654.06m, total);
        }