Ejemplo n.º 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));
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }