Beispiel #1
0
        public void Register_NewMethod()
        {
            _methodCallTransformerRegistry.Register(_methodInfo, _transformerStub);

            var expectedTransformer = _methodCallTransformerRegistry.GetItem(_methodInfo);

            Assert.That(_transformerStub, Is.SameAs(expectedTransformer));
        }
Beispiel #2
0
        public void GetItem()
        {
            var methodCallSqlGeneratorRegistry = new MethodInfoBasedMethodCallTransformerRegistry();

            methodCallSqlGeneratorRegistry.Register(_methodInfo, _transformerStub);

            var result = methodCallSqlGeneratorRegistry.GetItem(_methodInfo);

            Assert.That(result, Is.SameAs(_transformerStub));
        }
Beispiel #3
0
        public void GetTransformer()
        {
            var methodCallSqlGeneratorRegistry = new MethodInfoBasedMethodCallTransformerRegistry();

            methodCallSqlGeneratorRegistry.Register(_methodInfo, _transformerStub);
            var methodCallExpression = Expression.Call(_methodInfo, Expression.Constant("a"), Expression.Constant("b"));

            var result = methodCallSqlGeneratorRegistry.GetTransformer(methodCallExpression);

            Assert.That(result, Is.SameAs(_transformerStub));
        }
Beispiel #4
0
        public void VisitMethodCallExpression_ExpressionPropertiesVisitedBeforeTransformation()
        {
            var method = MethodCallTransformerUtility.GetInstanceMethod(typeof(object), "ToString");
            var methodCallExpression = Expression.Call(_cookQuerySourceReferenceExpression, method);

            var transformerMock = MockRepository.GenerateMock <IMethodCallTransformer>();

            transformerMock
            .Expect(mock => mock.Transform(Arg.Is(methodCallExpression)))
            .Return(methodCallExpression);
            transformerMock.Replay();

            var registry = new MethodInfoBasedMethodCallTransformerRegistry();

            registry.Register(method, transformerMock);

            SqlPreparationExpressionVisitor.TranslateExpression(methodCallExpression, _context, _stageMock, registry);

            transformerMock.VerifyAllExpectations();
        }
    public void GetItem ()
    {
      var methodCallSqlGeneratorRegistry = new MethodInfoBasedMethodCallTransformerRegistry ();
      methodCallSqlGeneratorRegistry.Register (_methodInfo, _transformerStub);

      var result = methodCallSqlGeneratorRegistry.GetItem (_methodInfo);

      Assert.That (result, Is.SameAs (_transformerStub));
    }
    public void GetTransformer ()
    {
      var methodCallSqlGeneratorRegistry = new MethodInfoBasedMethodCallTransformerRegistry ();
      methodCallSqlGeneratorRegistry.Register (_methodInfo, _transformerStub);
      var methodCallExpression = Expression.Call (_methodInfo, Expression.Constant ("a"), Expression.Constant ("b"));

      var result = methodCallSqlGeneratorRegistry.GetTransformer (methodCallExpression);

      Assert.That (result, Is.SameAs (_transformerStub));
    }