Пример #1
0
        public void GetItem_DontFindGenerator_ReturnsNull()
        {
            var methodCallSqlGeneratorRegistry = new MethodInfoBasedMethodCallTransformerRegistry();

            var result = methodCallSqlGeneratorRegistry.GetItem(_methodInfo);

            Assert.That(result, Is.Null);
        }
Пример #2
0
        public void GetItem()
        {
            var methodCallSqlGeneratorRegistry = new MethodInfoBasedMethodCallTransformerRegistry();

            methodCallSqlGeneratorRegistry.Register(_methodInfo, _transformerStub);

            var result = methodCallSqlGeneratorRegistry.GetItem(_methodInfo);

            Assert.That(result, Is.SameAs(_transformerStub));
        }
Пример #3
0
        private void AssertAllMethodsRegistered(MethodInfoBasedMethodCallTransformerRegistry registry, Type type)
        {
            var methodInfos = (MethodInfo[])type.GetField("SupportedMethods").GetValue(null);

            Assert.That(methodInfos.Length, Is.GreaterThan(0));

            foreach (var methodInfo in methodInfos)
            {
                Assert.That(registry.GetItem(methodInfo), Is.TypeOf(type));
            }
        }
Пример #4
0
        public void Register_NewMethod()
        {
            _methodCallTransformerRegistry.Register(_methodInfo, _transformerStub);

            var expectedTransformer = _methodCallTransformerRegistry.GetItem(_methodInfo);

            Assert.That(_transformerStub, Is.SameAs(expectedTransformer));
        }
    private void AssertAllMethodsRegistered (MethodInfoBasedMethodCallTransformerRegistry registry, Type type)
    {
      var methodInfos = (MethodInfo[]) type.GetField ("SupportedMethods").GetValue (null);
      Assert.That (methodInfos.Length, Is.GreaterThan (0));

      foreach (var methodInfo in methodInfos)
        Assert.That (registry.GetItem (methodInfo), Is.TypeOf (type));
    }
    public void GetItem ()
    {
      var methodCallSqlGeneratorRegistry = new MethodInfoBasedMethodCallTransformerRegistry ();
      methodCallSqlGeneratorRegistry.Register (_methodInfo, _transformerStub);

      var result = methodCallSqlGeneratorRegistry.GetItem (_methodInfo);

      Assert.That (result, Is.SameAs (_transformerStub));
    }
    public void GetItem_DontFindGenerator_ReturnsNull ()
    {
      var methodCallSqlGeneratorRegistry = new MethodInfoBasedMethodCallTransformerRegistry ();

      var result = methodCallSqlGeneratorRegistry.GetItem (_methodInfo);

      Assert.That (result, Is.Null);
    }