Example #1
0
        public void All_ColumnSpecification()
        {
            var films   = new Films(ProviderName);
            var allRows = films.All(columns: "film_id, description, language_id").ToList();

            Assert.AreEqual(1000, allRows.Count);
            var firstRow = allRows[0];

            Assert.Greater(firstRow.film_id, 0);
            Assert.AreNotEqual("", firstRow.description);
            Assert.Greater(firstRow.language_id, 0);
        }
Example #2
0
        public void All_WhereSpecification_ColumnsSpecification_LimitSpecification()
        {
            var films   = new Films(ProviderName);
            var allRows = films.All(limit: 2, columns: "film_id, description, language_id", where : "WHERE rental_duration=@0", args: 5).ToList();

            Assert.AreEqual(2, allRows.Count);
            var firstRow = allRows[0];

            Assert.Greater(firstRow.film_id, 0);
            Assert.AreNotEqual(firstRow.description, "");
            Assert.Greater(firstRow.language_id, 0);
        }
Example #3
0
        public void All_WhereSpecification_OrderBySpecification()
        {
            var films   = new Films(ProviderName);
            var allRows = films.All(orderBy: "film_id DESC", where : "WHERE rental_duration=@0", args: 5).ToList();

            Assert.AreEqual(191, allRows.Count);
            int previous = int.MaxValue;

            foreach (var r in allRows)
            {
                int current = r.film_id;
                Assert.IsTrue(current <= previous);
                previous = current;
            }
        }
Example #4
0
        public void All_OrderBySpecification()
        {
            var films   = new Films(ProviderName);
            var allRows = films.All(orderBy: "rental_duration DESC").ToList();

            Assert.AreEqual(1000, allRows.Count);
            int previous = int.MaxValue;

            foreach (var r in allRows)
            {
                int current = r.rental_duration;
                Assert.IsTrue(current <= previous);
                previous = current;
            }
        }
Example #5
0
        public void All_NoParameters_Streaming()
        {
            var films   = new Films(ProviderName);
            var allRows = films.All();
            var count   = 0;

            foreach (var r in allRows)
            {
                count++;
                Assert.Greater(r.film_id, 0);
                Assert.Greater(r.last_update, DateTime.MinValue);
                Assert.Greater(r.language_id, 0);
                Assert.Greater(r.rental_duration, 0);
                Assert.AreNotEqual(r.description, "");
            }
            Assert.AreEqual(1000, count);
        }