public void CreateSqlConnection() { IDataService service = new SqlClientDataService(); IDbConnection connection = service.CreateConnection(SqlConnection); Assert.IsNotNull(connection); Assert.IsInstanceOfType(connection, typeof(SqlConnection)); Assert.AreEqual(SqlConnection, connection.ConnectionString); }
public void CreateSqlSPCommand() { IDataService service = new SqlClientDataService(); IDbConnection connection = service.CreateConnection(SqlConnection); IDbCommand command = service.CreateSPCommand(SPName, connection); Assert.IsNotNull(command); Assert.IsInstanceOfType(command, typeof(SqlCommand)); Assert.AreEqual(SPName, command.CommandText); Assert.AreEqual(CommandType.StoredProcedure, command.CommandType); }
public void CreateSqlTextCommand() { IDataService service = new SqlClientDataService(); IDbConnection connection = service.CreateConnection(SqlConnection); IDbCommand command = service.CreateTextCommand(SelectText, connection); Assert.IsNotNull(command); Assert.IsInstanceOfType(command, typeof(SqlCommand)); Assert.AreEqual(SelectText, command.CommandText); Assert.AreEqual(CommandType.Text, command.CommandType); }
public void CreateSqlInputParameter() { IDataService service = new SqlClientDataService(); IDbConnection connection = service.CreateConnection(SqlConnection); IDbDataParameter parameter = service.CreateInputParameter("Id", 1); Assert.IsNotNull(parameter); Assert.IsInstanceOfType(parameter, typeof(SqlParameter)); Assert.AreEqual("@Id", parameter.ParameterName); Assert.AreEqual(1, parameter.Value); Assert.AreEqual(ParameterDirection.Input, parameter.Direction); }