public void BuildSelectStringWithForeignTableSqlServer() { // arrange var table = new Table("Hello", "Kitty", "hk"); var column = new NormalColumn("Test", table); var foreignColumn = new ForeignColumn("Sample"); var joinedTable = new JoinedTable("Something", "Somewhere", "ss", table, column, foreignColumn); var builder = new SelectStatementBuilder( new List<ISqlConstituent> { column, foreignColumn }, table, new List<ISqlConstituent> { joinedTable }); // act var selectStatement = builder.Build(); // assert const string ExpectedResult = @"SELECT [hk].[Test], [ss].[Sample] FROM [Hello].[Kitty] hk LEFT OUTER JOIN [Something].[Somewhere] ss ON [hk].[Test] = [ss].[Sample]"; AssertSameCharactersWithoutSpaces(ExpectedResult, selectStatement); }
public void BuildSelectStringWithForeignTableOracle() { // arrange var table = new Table("Hello", "Kitty", "hk", SqlType.Oracle); var column = new NormalColumn("Test", table, SqlType.Oracle); var foreignColumn = new ForeignColumn("Sample", SqlType.Oracle); var joinedTable = new JoinedTable("Something", "Somewhere", "ss", table, column, foreignColumn, sqlType: SqlType.Oracle); var builder = new SelectStatementBuilder( new List<ISqlConstituent> { column, foreignColumn }, table, new List<ISqlConstituent> { joinedTable }); // act var selectStatement = builder.Build(); // assert const string ExpectedResult = @"SELECT hk.Test, ss.Sample FROM Hello.Kitty hk LEFT OUTER JOIN Something.Somewhere ss ON hk.Test = ss.Sample"; AssertSameCharactersWithoutSpaces(ExpectedResult, selectStatement); }