Exemplo n.º 1
0
        public override bool Equals(object obj)
        {
            var otherKey = (IInlineMapperKey)obj;

            // ReSharper disable once PossibleNullReferenceException
            if ((_configurations.Length != otherKey.Configurations.Count) ||
                (ConfiguratorType != otherKey.ConfiguratorType) ||
                (RuleSet != otherKey.RuleSet) ||
                !MappingTypes.Equals(otherKey.MappingTypes))
            {
                return(false);
            }

            for (var i = 0; i < Configurations.Count; i++)
            {
                var configuration      = Configurations[i].Body;
                var otherConfiguration = otherKey.Configurations[i].Body;

                if (!ExpressionEvaluation.AreEquivalent(configuration, otherConfiguration))
                {
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 2
0
        private static void VerifyEquivalent(Expression one, Expression two)
        {
#if NET35
            ExpressionEvaluation.AreEquivalent(one.ToDlrExpression(), two.ToDlrExpression()).ShouldBeTrue();
#else
            ExpressionEvaluation.AreEquivalent(one, two).ShouldBeTrue();
#endif
        }
Exemplo n.º 3
0
        protected override Expression VisitMember(MemberExpression memberAccess)
        {
            if (ExpressionEvaluation.AreEquivalent(memberAccess, _sourceValue))
            {
                ++_numberOfAccesses;
            }

            return(base.VisitMember(memberAccess));
        }
Exemplo n.º 4
0
        public bool IsSameAs(IDataSource otherDataSource)
        {
            if (IsConditional &&
                otherDataSource.IsConditional &&
                ExpressionEvaluation.AreEqual(Condition, otherDataSource.Condition))
            {
                return(true);
            }

            return(ExpressionEvaluation.AreEquivalent(otherDataSource.Value, _originalValue));
        }
Exemplo n.º 5
0
        public bool IsSameAs(ConfiguredLambdaInfo otherLambdaInfo)
        {
            if (otherLambdaInfo == null)
            {
                return(false);
            }

            if ((_lambda.Body.NodeType == ExpressionType.Invoke) ||
                (otherLambdaInfo._lambda.Body.NodeType == ExpressionType.Invoke))
            {
                return(false);
            }

            return(ExpressionEvaluation.AreEquivalent(_lambda.Body, otherLambdaInfo._lambda.Body));
        }