コード例 #1
0
        public void GetAllTransformations()
        {
            Assert.That(_registry.GetAllTransformations(ExpressionType.Constant), Is.Empty);

            var transformerStub1 = CreateTransformerStub <Expression> (1, ExpressionType.Constant);

            _registry.Register(transformerStub1);

            var transformerStub2 = CreateTransformerStub <Expression> (1, ExpressionType.Constant);

            _registry.Register(transformerStub2);

            var transformerStub3 = CreateTransformerStub <Expression> (1, ExpressionType.Equal);

            _registry.Register(transformerStub3);

            var transformationsForConstant = _registry.GetAllTransformations(ExpressionType.Constant);

            Assert.That(GetTransformersFromTransformations(transformationsForConstant), Is.EqualTo(new[] { transformerStub1, transformerStub2 }));

            var transformationsForEqual = _registry.GetAllTransformations(ExpressionType.Equal);

            Assert.That(GetTransformersFromTransformations(transformationsForEqual), Is.EqualTo(new[] { transformerStub3 }));
        }