public void All_NoParameters() { var film = new Film(ProviderName); var allRows = film.All().ToList(); Assert.AreEqual(1000, allRows.Count); }
public void All_LimitSpecification() { var film = new Film(ProviderName); var allRows = film.All(limit: 10).ToList(); Assert.AreEqual(10, allRows.Count); }
public void All_WhereSpecification() { var film = new Film(ProviderName); var allRows = film.All(where : "WHERE rental_duration=@0", args: 5).ToList(); Assert.AreEqual(191, allRows.Count); }
public void All_WhereSpecification_ToDataTable() { var film = new Film(ProviderName); var allRows = film.All(where : "WHERE rental_duration=@0", args: 5).ToList(); Assert.AreEqual(191, allRows.Count); var allRowsAsDataTable = film.All(where : "WHERE rental_duration=@0", args: 5).ToDataTable(); Assert.AreEqual(allRows.Count, allRowsAsDataTable.Rows.Count); for (int i = 0; i < allRows.Count; i++) { Assert.AreEqual(allRows[i].film_id, allRowsAsDataTable.Rows[i]["film_id"]); Assert.AreEqual(5, allRowsAsDataTable.Rows[i]["rental_duration"]); } }
public void All_WhereSpecification_ColumnsSpecification_LimitSpecification() { var film = new Film(ProviderName); var allRows = film.All(limit: 2, columns: "film_id as FILMID, description, language_id", where : "WHERE rental_duration=@0", args: 5).ToList(); Assert.AreEqual(2, allRows.Count); var firstRow = (IDictionary <string, object>)allRows[0]; Assert.AreEqual(3, firstRow.Count); Assert.IsTrue(firstRow.ContainsKey("FILMID")); Assert.IsTrue(firstRow.ContainsKey("description")); Assert.IsTrue(firstRow.ContainsKey("language_id")); }
public void All_NoParameters_Streaming() { var film = new Film(ProviderName); var allRows = film.All(); var count = 0; foreach (var r in allRows) { count++; Assert.AreEqual(13, ((IDictionary <string, object>)r).Count); // # of fields fetched should be 13 } Assert.AreEqual(1000, count); }
public void All_ColumnSpecification() { var film = new Film(ProviderName); var allRows = film.All(columns: "film_id as FILMID, description, language_id").ToList(); Assert.AreEqual(1000, allRows.Count); var firstRow = (IDictionary <string, object>)allRows[0]; Assert.AreEqual(3, firstRow.Count); Assert.IsTrue(firstRow.ContainsKey("FILMID")); Assert.IsTrue(firstRow.ContainsKey("description")); Assert.IsTrue(firstRow.ContainsKey("language_id")); }
public void All_ColumnSpecification() { // specify columns a different way to cause a cache miss (but this does cache wrt async version) var film = new Film(ProviderName, columns: "film_id as FILMID, description, language_id"); var allRows = film.All().ToList(); Assert.AreEqual(1000, allRows.Count); var firstRow = (IDictionary <string, object>)allRows[0]; Assert.AreEqual(3, firstRow.Count); Assert.IsTrue(firstRow.ContainsKey("FILMID")); Assert.IsTrue(firstRow.ContainsKey("description")); Assert.IsTrue(firstRow.ContainsKey("language_id")); }
public void All_WhereSpecification_OrderBySpecification() { var film = new Film(ProviderName); var allRows = film.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; } }
public void All_OrderBySpecification() { var film = new Film(ProviderName); var allRows = film.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; } }