5 // Copyright (c) 2007-2008 Jiri Moudry, Pascal Craponne
\r
7 // Permission is hereby granted, free of charge, to any person obtaining a copy
\r
8 // of this software and associated documentation files (the "Software"), to deal
\r
9 // in the Software without restriction, including without limitation the rights
\r
10 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
\r
11 // copies of the Software, and to permit persons to whom the Software is
\r
12 // furnished to do so, subject to the following conditions:
\r
14 // The above copyright notice and this permission notice shall be included in
\r
15 // all copies or substantial portions of the Software.
\r
17 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
18 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
\r
19 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
\r
20 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
\r
21 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
\r
22 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
\r
28 using System.Collections.Generic;
\r
31 using NUnit.Framework;
\r
38 namespace Test_NUnit_MySql
\r
40 namespace Test_NUnit_OracleODP
\r
42 namespace Test_NUnit_Oracle
\r
44 namespace Test_NUnit_PostgreSql
\r
46 namespace Test_NUnit_Sqlite
\r
48 namespace Test_NUnit_Ingres
\r
49 #elif MSSQL && L2SQL
\r
50 namespace Test_NUnit_MsSql_Strict
\r
52 namespace Test_NUnit_MsSql
\r
54 namespace Test_NUnit_Firebird
\r
58 public class StoredProcTest : TestBase
\r
61 #if !SQLITE && !MSSQL && !L2SQL && !FIREBIRD && !POSTGRES
\r
63 public void SP1_CallHello0()
\r
65 Northwind db = base.CreateDB();
\r
66 string result = db.Hello0();
\r
67 Assert.IsNotNull(result);
\r
71 public void SP2_CallHello1()
\r
73 Northwind db = base.CreateDB();
\r
74 string result = db.Hello1("xx");
\r
75 Assert.IsTrue(result!=null && result.Contains("xx"));
\r
79 public void SP3_GetOrderCount_SelField()
\r
81 Northwind db = base.CreateDB();
\r
82 var q = from c in db.Customers
\r
83 select new { c.CustomerID, OrderCount = db.GetOrderCount(c.CustomerID) };
\r
86 foreach (var c in q)
\r
88 Assert.IsNotNull(c.CustomerID);
\r
89 Assert.Greater(c.OrderCount, -1);
\r
92 Assert.Greater(count, 0);
\r
96 public void SP4_GetOrderCount_SelField_B()
\r
98 Northwind db = base.CreateDB();
\r
99 var q = from c in db.Customers
\r
100 select new {c, OrderCount=db.GetOrderCount(c.CustomerID)};
\r
103 foreach (var v in q)
\r
105 Assert.IsNotNull(v.c.CustomerID);
\r
106 Assert.Greater(v.OrderCount, -1);
\r
109 Assert.Greater(count, 0);
\r
113 public void SPB_GetOrderCount_Having()
\r
115 Northwind db = base.CreateDB();
\r
116 var q = from c in db.Customers where db.GetOrderCount(c.CustomerID) > 1 select c;
\r
119 foreach (var c in q)
\r
121 Assert.IsTrue(c.CustomerID!=null, "Non-null customerID required");
\r
124 Assert.Greater(count, 0);
\r