[System.Data] Fixes tests build with mobile profiles
[mono-project.git] / mcs / class / System.Data / Test / System.Data.Odbc / OdbcParameterCollectionTest.cs
blob17d7086abffabe453f062df38c7a6fa47619374b
1 //
2 // OdbcParameterCollectionTest.cs - NUnit Test Cases for testing the
3 // OdbcParameterCollection class
4 // Author:
5 // Sureshkumar T (TSureshkumar@novell.com)
6 //
7 // Copyright (c) 2004 Novell Inc., and the individuals listed
8 // on the ChangeLog entries.
9 //
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 #if !NO_ODBC
32 using System;
33 using System.Text;
34 using System.Data;
35 using System.Data.Odbc;
37 using NUnit.Framework;
39 namespace MonoTests.System.Data.Odbc
42 [TestFixture]
43 public class OdbcParameterCollectionTest
45 [Test]
46 public void OdbcParameterAddTest ()
48 AddTest (new OdbcCommand ());
51 /// <remarks>
52 /// Test for parameter length of various data types.
53 /// </remarks>
54 public void AddTest (OdbcCommand cmd)
56 OdbcParameter param = cmd.Parameters.Add ("param1", (int) 1);
57 param = cmd.Parameters.Add ("param1", (long) 1);
58 Assert.AreEqual (0, param.Size, "#1");
59 param = cmd.Parameters.Add ("param1", (float) 1.0);
60 Assert.AreEqual (0, param.Size, "#2");
61 param = cmd.Parameters.Add ("param1", (double) 1.0);
62 Assert.AreEqual (0, param.Size, "#3");
63 param = cmd.Parameters.Add ("param1",
64 ASCIIEncoding.ASCII.GetBytes("this is considerably long test"));
65 Assert.AreEqual (30, param.Size, "#4");
66 param = cmd.Parameters.Add ("param1", true);
67 Assert.AreEqual (0, param.Size, "#5");
68 param = cmd.Parameters.Add ("param1", "suresh");
69 Assert.AreEqual (6, param.Size, "#6");
70 param = cmd.Parameters.Add ("param1", DateTime.Now);
71 Assert.AreEqual (0, param.Size, "#7");
72 param = cmd.Parameters.Add ("param1", (object) DateTime.Now);
73 Assert.AreEqual (0, param.Size, "#8");
75 int [] arr = new int [] {1, 2, 3} ;
76 param = cmd.Parameters.Add ("param1", arr);
78 Assert.AreEqual (0, param.Size, "#8");
84 #endif