public void TestSetItemByName() { using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) { SqlServerCommand command = new SqlServerCommand("test", "procTest"); SqlServerParameterCollection coll = command.Parameters; SqlServerParameter param = command.CreateParameter(); param.ParameterName = "Param1"; coll.Add(param); Assert.IsTrue(coll.Contains(param)); Assert.IsTrue(coll.Contains("Param1")); Assert.AreEqual(param, coll[0]); Assert.AreEqual(param, coll["Param1"]); Assert.AreEqual(param, ((IList)coll)[0]); param = command.CreateParameter(); param.ParameterName = "Param2"; coll["Param1"] = param; Assert.AreEqual(1, coll.Count); Assert.IsTrue(coll.Contains(param)); Assert.IsTrue(coll.Contains("Param2")); Assert.AreEqual(param, coll[0]); Assert.AreEqual(param, coll["Param2"]); Assert.AreEqual(param, ((IList)coll)[0]); } }
public void TestIListRemove() { using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) { SqlServerCommand command = new SqlServerCommand("test", "procTest"); SqlServerParameterCollection coll = command.Parameters; SqlServerParameter param = command.CreateParameter(); param.ParameterName = "Param1"; coll.Add(param); Assert.IsTrue(coll.Contains(param)); Assert.IsTrue(coll.Contains("Param1")); Assert.AreEqual(1, coll.Count); SqlServerParameter param2 = command.CreateParameter(); param2.ParameterName = "Param2"; coll.Add(param2); Assert.IsTrue(coll.Contains(param2)); Assert.IsTrue(coll.Contains("Param2")); Assert.AreEqual(2, coll.Count); ((IList)coll).Remove(param); Assert.IsTrue(coll.Contains(param2)); Assert.IsTrue(coll.Contains("Param2")); Assert.IsFalse(coll.Contains(param)); Assert.IsFalse(coll.Contains("Param1")); Assert.AreEqual(1, coll.Count); } }
public void TestConstructeur() { using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) { SqlServerCommand command = new SqlServerCommand("test", "procTest"); Assert.IsNotNull(command.CreateParameter()); } }
public void TestIsNull() { using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) { SqlServerCommand command = new SqlServerCommand("test", "procTest"); IDataParameter param = command.CreateParameter(); Assert.IsTrue(param.IsNullable); } }
public void TestParameterName() { using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) { SqlServerCommand command = new SqlServerCommand("test", "procTest"); SqlServerParameter param = command.CreateParameter(); param.ParameterName = "Param1"; Assert.AreEqual("Param1", param.ParameterName); } }
public void TestDirection() { using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) { SqlServerCommand command = new SqlServerCommand("test", "procTest"); SqlServerParameter param = command.CreateParameter(); param.Direction = ParameterDirection.Output; Assert.AreEqual(ParameterDirection.Output, param.Direction); } }
public void TestDbType() { using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) { SqlServerCommand command = new SqlServerCommand("test", "procTest"); SqlServerParameter param = command.CreateParameter(); param.DbType = DbType.String; Assert.AreEqual(DbType.String, param.DbType); } }
public void TestValueDbNull() { using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) { SqlServerCommand command = new SqlServerCommand("test", "procTest"); SqlServerParameter param = command.CreateParameter(); param.Value = DBNull.Value; Assert.IsNull(param.Value); } }
public void TestSourceVersion() { using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) { SqlServerCommand command = new SqlServerCommand("test", "procTest"); IDataParameter param = command.CreateParameter(); param.SourceVersion = DataRowVersion.Proposed; Assert.AreEqual(DataRowVersion.Proposed, param.SourceVersion); } }
public void TestSourceColumn() { using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) { SqlServerCommand command = new SqlServerCommand("test", "procTest"); IDataParameter param = command.CreateParameter(); param.SourceColumn = "Column1"; Assert.AreEqual("Column1", param.SourceColumn); } }
public void TestPrecision() { using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) { SqlServerCommand command = new SqlServerCommand("test", "procTest"); SqlServerParameter param = command.CreateParameter(); param.DbType = DbType.Decimal; param.Precision = 5; Assert.AreEqual(0, param.Precision); } }
public void TestAdd() { using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) { SqlServerCommand command = new SqlServerCommand("test", "procTest"); SqlServerParameterCollection coll = command.Parameters; SqlServerParameter param = command.CreateParameter(); param.ParameterName = "Param1"; coll.Add(param); Assert.IsTrue(coll.Contains(param)); Assert.IsTrue(coll.Contains("Param1")); Assert.IsTrue(((IList)coll).Contains(param)); } }
public void TestICollectionCopyTo() { using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) { SqlServerCommand command = new SqlServerCommand("test", "procTest"); SqlServerParameterCollection coll = command.Parameters; SqlServerParameter param = command.CreateParameter(); param.ParameterName = "Param1"; coll.Add(param); Assert.IsTrue(coll.Contains(param)); Assert.IsTrue(coll.Contains("Param1")); Assert.IsTrue(((IList)coll).Contains(param)); object[] array = new object[1]; ((ICollection)coll).CopyTo(array, 0); Assert.AreEqual(param, array[0]); } }