コード例 #1
0
        public void ItShouldHandleASimpleMinus()
        {
            var stream =
                AST.SqlExpression.NewSelect(
                    AST.SelectExpression.NewPlain(
                        AST.PlainSelectExpression.NewSet(
                            S.Minus(
                                S.PlainSelect(
                                    S.Select(S.Star <Person>()),
                                    S.From <Person>()),
                                S.PlainSelect(
                                    S.Select(S.Star <Person>()),
                                    S.From <Person>(),
                                    S.Where(
                                        S.BinExp(S.Col <Person>("Age"), AST.BinaryOperation.GreaterThan, S.Const(42))))))));
            var result = SqlGen.SqlifyExpression(AnsiSql.Dialect, stream);

            var expected =
                "SELECT PersonRef.* FROM Person PersonRef " +
                "MINUS " +
                "SELECT PersonRef.* FROM Person PersonRef WHERE PersonRef.Age > 42";

            Assert.That(result, Is.EqualTo(expected));
        }