public void NullableValue_ReplacedByCast()
        {
// ReSharper disable PossibleInvalidOperationException
            var query = DetailQuerySource.Select(k => k.LastCleaningDay.Value);
// ReSharper restore PossibleInvalidOperationException

            var queryModel = QueryParser.GetParsedQuery(query.Expression);

            var selector = queryModel.SelectClause.Selector;

// ReSharper disable PossibleInvalidOperationException
            CheckResolvedExpression <Kitchen, DateTime> (selector, queryModel.MainFromClause, k => (DateTime)k.LastCleaningDay);
// ReSharper restore PossibleInvalidOperationException
        }
        public void NullableHasValue_ReplacedByNullCheck()
        {
            var query = DetailQuerySource.Where(k => k.LastCleaningDay.HasValue);

            var queryModel = QueryParser.GetParsedQuery(query.Expression);

            var predicate          = ((WhereClause)queryModel.BodyClauses[0]).Predicate;
            var expectedExpression =
                Expression.NotEqual(
                    Expression.MakeMemberAccess(
                        new QuerySourceReferenceExpression(queryModel.MainFromClause),
                        typeof(Kitchen).GetProperty("LastCleaningDay")),
                    Expression.Constant(null, typeof(DateTime?)));

            ExpressionTreeComparer.CheckAreEqualTrees(expectedExpression, predicate);
        }