public void TestTypeMismatchInObjectReader() { InsightTestData[] array = new InsightTestData[] { new InsightTestData() }; // run the query _connection.QuerySql<InsightTestData>("InsightTestDataTestProc2", new { p = array.ToList() }); }
public void TestEnumerableClassListParameters() { for (int i = 0; i < 3; i++) { // build test data InsightTestData[] array = new InsightTestData[i]; for (int j = 0; j < i; j++) { array[j] = new InsightTestData() { Int = j } } ; // run the query var items = Connection().QuerySql <InsightTestData>("SELECT * FROM @p", new { p = array.ToList() }); Assert.IsNotNull(items); Assert.AreEqual(i, items.Count); for (int j = 0; j < i; j++) { Assert.AreEqual(j, items[j].Int); } } // make sure that we cannot send up a null item in the list Assert.Throws <InvalidOperationException>(() => Connection().QuerySql <InsightTestData>("SELECT * FROM @p", new { p = new List <InsightTestData>() { new InsightTestData(), null, new InsightTestData() } })); }
public void TestEnumerableClassListParameters() { for (int i = 0; i < 3; i++) { // build test data InsightTestData[] array = new InsightTestData[i]; for (int j = 0; j < i; j++) array[j] = new InsightTestData() { Int = j }; // run the query var items = _connection.QuerySql<InsightTestData>("SELECT * FROM @p", new { p = array.ToList() }); Assert.IsNotNull(items); Assert.AreEqual(i, items.Count); for (int j = 0; j < i; j++) Assert.AreEqual(j, items[j].Int); } // make sure that we cannot send up a null item in the list Assert.Throws<InvalidOperationException>(() => _connection.QuerySql<InsightTestData>("SELECT * FROM @p", new { p = new List<InsightTestData>() { new InsightTestData(), null, new InsightTestData() } })); }
public void TestTypeMismatchInObjectReader() { InsightTestData[] array = new InsightTestData[] { new InsightTestData() }; // run the query Connection().QuerySql <InsightTestData>("InsightTestDataTestProc2", new { p = array.ToList() }); }