예제 #1
0
        public void GetHashcode_EqualSqlStatementsWithAllMembers()
        {
            var dataInfo                      = new TestStreamedValueInfo(typeof(int));
            var isDistinctQuery               = BooleanObjectMother.GetRandomBoolean();
            var selectProjection              = Expression.Constant(1);
            var sqlTable                      = new SqlTable(new ResolvedSimpleTableInfo(typeof(Cook), "CookTable", "c"), JoinSemantics.Inner);
            var ordering                      = new Ordering(Expression.Constant("ordering"), OrderingDirection.Asc);
            var whereCondition                = Expression.Constant(true);
            var topExpression                 = Expression.Constant("top");
            var rowNumberSelector             = Expression.Constant("selector1");
            var currentRowNumberOffset        = Expression.Constant(1);
            var groupByExpression             = Expression.Constant("group");
            var setOperationCombinedStatement = SqlStatementModelObjectMother.CreateSetOperationCombinedStatement();

            var sqlStatement1 = new SqlStatement(
                dataInfo,
                selectProjection,
                new[] { sqlTable },
                whereCondition,
                groupByExpression,
                new[] { ordering },
                topExpression,
                isDistinctQuery,
                rowNumberSelector,
                currentRowNumberOffset,
                new[] { setOperationCombinedStatement });

            var sqlStatement2 = new SqlStatement(
                dataInfo,
                selectProjection,
                new[] { sqlTable },
                whereCondition,
                groupByExpression,
                new[] { ordering },
                topExpression,
                isDistinctQuery,
                rowNumberSelector,
                currentRowNumberOffset,
                new[] { setOperationCombinedStatement });

            Assert.That(sqlStatement1.GetHashCode(), Is.EqualTo(sqlStatement2.GetHashCode()));
        }