예제 #1
0
        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());
        }
예제 #2
0
        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());
        }
예제 #3
0
        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());
        }
예제 #4
0
        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());
        }