18 using NUnit.Framework;
20 namespace Deveel.Data.Client {
25 IDbConnection connection = null;
26 Assert.DoesNotThrow(() => connection =
Database.CreateDbConnection(AdminUserName, AdminPassword));
27 Assert.IsNotNull(connection);
29 Assert.AreEqual(ConnectionState.Closed, connection.State);
30 Assert.DoesNotThrow(() => connection.Open());
31 Assert.AreEqual(ConnectionState.Open, connection.State);
32 Assert.DoesNotThrow(() => connection.Close());
33 Assert.AreEqual(ConnectionState.Closed, connection.State);
38 IDbConnection connection = null;
39 Assert.DoesNotThrow(() => connection =
Database.CreateDbConnection(AdminUserName, AdminPassword));
40 Assert.IsNotNull(connection);
42 IDbCommand command = null;
43 Assert.DoesNotThrow(() => command = connection.CreateCommand());
44 Assert.IsNotNull(command);
46 command.CommandText =
"SELECT user()";
49 Assert.DoesNotThrow(() => value = command.ExecuteScalar());
50 Assert.IsNotNull(value);
51 Assert.IsInstanceOf<
string>(value);
52 Assert.AreEqual(AdminUserName, value);
54 Assert.DoesNotThrow(() => connection.Dispose());
59 IDbConnection connection = null;
60 Assert.DoesNotThrow(() => connection =
Database.CreateDbConnection(AdminUserName, AdminPassword));
61 Assert.IsNotNull(connection);
63 IDbCommand command = null;
64 Assert.DoesNotThrow(() => command = connection.CreateCommand());
65 Assert.IsNotNull(command);
67 command.CommandText =
"SELECT user()";
69 IDataReader reader = null;
70 Assert.DoesNotThrow(() => reader = command.ExecuteReader());
71 Assert.IsNotNull(reader);
72 Assert.AreEqual(1, reader.FieldCount);
73 Assert.IsTrue(reader.Read());
76 Assert.DoesNotThrow(() => value = reader.GetValue(0));
77 Assert.IsInstanceOf<
string>(value);
The default implementation of a database in a system.
void QueryScalarForAdmin()