2d774c9280a1e402d6df35f131223881676eb425
[mono.git] / mcs / class / FirebirdSql.Data.Firebird / Test / FbParameterTest.cs
1 /*
2  *  Firebird ADO.NET Data provider for .NET and Mono 
3  * 
4  *     The contents of this file are subject to the Initial 
5  *     Developer's Public License Version 1.0 (the "License"); 
6  *     you may not use this file except in compliance with the 
7  *     License. You may obtain a copy of the License at 
8  *     http://www.firebirdsql.org/index.php?op=doc&id=idpl
9  *
10  *     Software distributed under the License is distributed on 
11  *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
12  *     express or implied.  See the License for the specific 
13  *     language governing rights and limitations under the License.
14  * 
15  *  Copyright (c) 2002, 2004 Carlos Guzman Alvarez
16  *  All Rights Reserved.
17  */
18
19 using System;
20 using System.Data;
21 using System.Data.Common;
22
23 using NUnit.Framework;
24 using FirebirdSql.Data.Firebird;
25
26 namespace FirebirdSql.Data.Firebird.Tests
27 {
28         [TestFixture]
29         public class FbParameterTest : BaseTest 
30         {
31                 public FbParameterTest() : base()
32                 {               
33                 }
34                 
35                 [Test]
36                 public void ConstructorsTest()
37                 {
38                         FbParameter ctor01 = new FbParameter();
39                         FbParameter ctor02 = new FbParameter("ctor2", 10);
40                         FbParameter ctor03 = new FbParameter("ctor3", FbDbType.Char);
41                         FbParameter ctor04 = new FbParameter("ctor4", FbDbType.Integer, 4);
42                         FbParameter ctor05 = new FbParameter("ctor5", FbDbType.Integer, 4, "int_field");
43                         FbParameter ctor06 = new FbParameter(
44                                 "ctor6", 
45                                 FbDbType.Integer, 
46                                 4, 
47                                 ParameterDirection.Input, 
48                                 false, 
49                                 0, 
50                                 0, 
51                                 "int_field", 
52                                 DataRowVersion.Original, 
53                                 100);
54
55             ctor01 = null;
56             ctor02 = null;
57             ctor03 = null;
58             ctor04 = null;
59             ctor05 = null;
60             ctor06 = null;
61                 }
62
63         [Test]
64         public void CloneTest()
65         {
66             FbParameter p = new FbParameter("@p1", FbDbType.Integer);
67             p.Value = 1;
68             p.Charset = FbCharset.Dos850;
69
70             FbParameter p1 = ((ICloneable)p).Clone() as FbParameter;
71
72             Assert.AreEqual(p1.ParameterName, p.ParameterName);
73             Assert.AreEqual(p1.FbDbType     , p.FbDbType);
74             Assert.AreEqual(p1.DbType       , p.DbType);
75             Assert.AreEqual(p1.Direction    , p.Direction);
76             Assert.AreEqual(p1.SourceColumn , p.SourceColumn);
77             Assert.AreEqual(p1.SourceVersion, p.SourceVersion);
78             Assert.AreEqual(p1.Charset      , p.Charset);
79             Assert.AreEqual(p1.IsNullable   , p.IsNullable);
80             Assert.AreEqual(p1.Size         , p.Size);
81             Assert.AreEqual(p1.Scale        , p.Scale);
82             Assert.AreEqual(p1.Precision    , p.Precision);
83             Assert.AreEqual(p1.Value        , p.Value);
84         }
85     }
86 }