public void Translate_NoVisitor_ThrowsArgumentNullException()
        {
            // Arrange

            var method = typeof(N1QlFunctions).GetMethod("Key");
            var expression = Expression.Call(method,
                Expression.Constant("arg1"));

            var transformer = new KeyMethodCallTranslator();

            // Act/Assert

            var result = Assert.Throws<ArgumentNullException>(() => transformer.Translate(expression, null));

            Assert.AreEqual("expressionTreeVisitor", result.ParamName);
        }
        public void Translate_NoMethod_ThrowsArgumentNullException()
        {
            // Arrange

            var visitor = new Mock<N1QlExpressionTreeVisitor>(new N1QlQueryGenerationContext())
            {
                CallBase = true
            };

            var transformer = new KeyMethodCallTranslator();

            // Act/Assert

            var result = Assert.Throws<ArgumentNullException>(() => transformer.Translate(null, visitor.Object));

            Assert.AreEqual("methodCallExpression", result.ParamName);
        }
        public void Translate_OneParameter_RendersCorrectly()
        {
            // Arrange

            var visitor = new Mock<N1QlExpressionTreeVisitor>(new N1QlQueryGenerationContext())
            {
                CallBase = true
            };

            var method = typeof(N1QlFunctions).GetMethod("Key");
            var expression = Expression.Call(method,
                Expression.Constant("arg1"));

            var transformer = new KeyMethodCallTranslator();

            // Act

            transformer.Translate(expression, visitor.Object);
            var result = visitor.Object.GetN1QlExpression();

            // Assert

            Assert.AreEqual("META('arg1').id", result);
        }