private static String CreateConnectionStringToContextDatabase() { TestDatabaseFacade facade = new TestDatabaseFacade(); String server = facade.ServerName; String database = facade.DatabaseName; System.Data.SqlClient.SqlConnectionStringBuilder builder = new System.Data.SqlClient.SqlConnectionStringBuilder(); builder["Data Source"] = server; builder["Integrated Security"] = true; builder["Initial Catalog"] = database; String connectionString = builder.ConnectionString; return connectionString; }
private static String CreateConnectionStringToContextDatabase() { TestDatabaseFacade facade = new TestDatabaseFacade(); String server = facade.ServerName; String database = facade.DatabaseName; System.Data.SqlClient.SqlConnectionStringBuilder builder = new System.Data.SqlClient.SqlConnectionStringBuilder(); builder["Data Source"] = server; builder["Integrated Security"] = true; builder["Initial Catalog"] = database; String connectionString = builder.ConnectionString; return(connectionString); }
public ResultSetFilter(TestDatabaseFacade testDatabaseFacade) { this.testDatabaseFacade = testDatabaseFacade; }
public TableFiller(TestDatabaseFacade testDatabaseFacade) { this.testDatabaseFacade = testDatabaseFacade; }
public OutputCaptor(TestDatabaseFacade testDatabaseFacade) { this.testDatabaseFacade = testDatabaseFacade; }
public static SqlChars TableToString(SqlString TableName, SqlString OrderOption, SqlString ColumnList) { if (TableName.IsNull) { throw new Exception("Object name cannot be NULL"); } if (OrderOption.IsNull) { OrderOption = ""; } if (ColumnList.IsNull) { ColumnList = ""; } TestDatabaseFacade testDbFacade = new TestDatabaseFacade(); String selectStmt = getSqlStatement(ref TableName, ref OrderOption); SqlDataReader reader = testDbFacade.executeCommand(selectStmt); List<String[]> results = getTableStringArray(reader, ColumnList); int numRows = 0; int[] ColumnLength = new int[results[0].Length]; foreach (String[] rowData in results) { for (int i = 0; i < rowData.Length; i++) { ColumnLength[i] = Math.Max(ColumnLength[i], rowData[i].Length); } numRows++; } for (int i = 0; i < ColumnLength.Length; i++) { ColumnLength[i] = Math.Min(ColumnLength[i], MAX_COLUMN_WIDTH); } int size = 0; foreach (int i in ColumnLength) { size += 1 + i; } size++; size *= (numRows + 1); bool isHeader = true; StringBuilder output = new StringBuilder(size); foreach (String[] rowData in results) { if (!isHeader) { output.AppendLine(); } for (int i = 0; i < rowData.Length; i++) { output.Append("|").Append(PadColumn(TrimToMaxLength(rowData[i]), ColumnLength[i])); } output.Append("|"); if (isHeader) { isHeader = false; output.AppendLine(); for (int i = 0; i < rowData.Length; i++) { output.Append("+"); output.Insert(output.Length, "-", ColumnLength[i]); } output.Append("+"); } } return new SqlChars(output.ToString()); }
public static SqlChars TableToString(SqlString TableName, SqlString OrderOption, SqlString ColumnList) { if (TableName.IsNull) { throw new Exception("Object name cannot be NULL"); } if (OrderOption.IsNull) { OrderOption = ""; } if (ColumnList.IsNull) { ColumnList = ""; } TestDatabaseFacade testDbFacade = new TestDatabaseFacade(); String selectStmt = getSqlStatement(ref TableName, ref OrderOption); SqlDataReader reader = testDbFacade.executeCommand(selectStmt); List <String[]> results = getTableStringArray(reader, ColumnList); int numRows = 0; int[] ColumnLength = new int[results[0].Length]; foreach (String[] rowData in results) { for (int i = 0; i < rowData.Length; i++) { ColumnLength[i] = Math.Max(ColumnLength[i], rowData[i].Length); } numRows++; } for (int i = 0; i < ColumnLength.Length; i++) { ColumnLength[i] = Math.Min(ColumnLength[i], MAX_COLUMN_WIDTH); } int size = 0; foreach (int i in ColumnLength) { size += 1 + i; } size++; size *= (numRows + 1); bool isHeader = true; StringBuilder output = new StringBuilder(size); foreach (String[] rowData in results) { if (!isHeader) { output.AppendLine(); } for (int i = 0; i < rowData.Length; i++) { output.Append("|").Append(PadColumn(TrimToMaxLength(rowData[i]), ColumnLength[i])); } output.Append("|"); if (isHeader) { isHeader = false; output.AppendLine(); for (int i = 0; i < rowData.Length; i++) { output.Append("+"); output.Insert(output.Length, "-", ColumnLength[i]); } output.Append("+"); } } return(new SqlChars(output.ToString())); }
public MetaDataEqualityAsserter(TestDatabaseFacade testDatabaseFacade) { this.testDatabaseFacade = testDatabaseFacade; }
public ResultSetToTable(TestDatabaseFacade testDatabaseFacade) { this.testDatabaseFacade = testDatabaseFacade; }