public void SelectAllColumnsTwoTables() { const string expected = "SELECT * FROM [Sales].[Customer], [Sales].[Currency]"; SqlCommandWriter writer = new SqlCommandWriter(); writer.WriteSelect(); writer.WriteFrom(Customer.Table, Currency.Table); Util.AssertStringsSame(expected, writer.ToString()); }
public void SelectTwoColumns() { const string expected = "SELECT _t0.[CustomerID], _t0.[AccountNumber] FROM [Sales].[Customer] _t0"; SqlCommandWriter writer = new SqlCommandWriter(); writer.WriteSelect(Customer.Columns.CustomerId, Customer.Columns.AccountNumber); writer.WriteFrom(DataRecord <Customer> .Table); Util.AssertStringsSame(expected, writer.ToString()); }
public void SelectAllColumnsOneTable() { const string expected = "SELECT * FROM [Sales].[Customer]"; SqlCommandWriter writer = new SqlCommandWriter(); writer.WriteSelect(); writer.WriteFrom(DataRecord <Customer> .Table); Util.AssertStringsSame(expected, writer.ToString()); }
public void SelectTwoColumnsWithWhere() { const string expected = "SELECT _t0.[CustomerID], _t0.[AccountNumber] FROM [Sales].[Customer] _t0" + " WHERE _t0.[CustomerID] > 100"; SqlCommandWriter writer = new SqlCommandWriter(); writer.WriteSelect(Customer.Columns.CustomerId, Customer.Columns.AccountNumber); writer.WriteFrom(DataRecord <Customer> .Table); writer.WriteWhere(); writer.WritePredicate(Customer.Columns.CustomerId, ">", new ParameterNames("_p0", null)); Util.AssertStringsSame(expected, writer.ToString()); }