public void VisitNewExpression_ForObjectID_GeneratesNullCheckInInMemoryProjection()
        {
            var constructorInfo = typeof(ObjectID).GetConstructor(new[] { typeof(string), typeof(object) });

            Assertion.IsNotNull(constructorInfo);
            var newObjectIDExpression = Expression.New(
                constructorInfo,
                new SqlColumnDefinitionExpression(typeof(string), "t0", "CustomerClassID", false),
                Expression.Convert(new SqlColumnDefinitionExpression(typeof(Guid), "t0", "CustomerID", false), typeof(object)));
            var compoundExpression = NamedExpression.CreateNewExpressionWithNamedArguments(newObjectIDExpression);

            ExtendedSqlGeneratingOuterSelectExpressionVisitor.GenerateSql(compoundExpression, _commandBuilder, _stageMock, _someSetOperationsMode);

            Assert.That(_commandBuilder.GetCommandText(), Is.EqualTo("[t0].[CustomerClassID] AS [m0],[t0].[CustomerID] AS [m1]"));

            Expression <Func <IDatabaseResultRow, ObjectID> > expectedInMemoryProjection =
                row => ExtendedSqlGeneratingOuterSelectExpressionVisitor.GetObjectIDOrNull(
                    row.GetValue <string> (new ColumnID("m0", 0)),
                    row.GetValue <object> (new ColumnID("m1", 1)));
            var expectedInMemoryProjectionBody = PartialEvaluatingExpressionVisitor.EvaluateIndependentSubtrees(
                expectedInMemoryProjection.Body,
                new TestEvaluatableExpressionFilter());

            SqlExpressionTreeComparer.CheckAreEqualTrees(expectedInMemoryProjectionBody, _commandBuilder.GetInMemoryProjectionBody());
        }
        public void GenerateSql_Collection()
        {
            var expression = Expression.Constant(new Order[] { });

            ExtendedSqlGeneratingOuterSelectExpressionVisitor.GenerateSql(expression, _commandBuilder, _stageMock, _someSetOperationsMode);
        }