public TypeSubstitutionExpressionVisitor(IDictionary <Type, Type> typeMap)
#endif
        {
            if (typeMap == null)
            {
                throw new ArgumentNullException(nameof(typeMap));
            }

            _subst = new TypeSubstitutor(typeMap);
        }
        public void TypeSubstitutor_Array()
        {
            var subst = new TypeSubstitutor(new Dictionary <Type, Type>
            {
                { typeof(int[]), typeof(long[]) }
            });

            Assert.IsNull(subst.Visit(type: null));
            Assert.AreSame(typeof(string), subst.Visit(typeof(string)));
            Assert.AreSame(typeof(List <string[]> [, ]), subst.Visit(typeof(List <string[]> [, ])));

            Assert.AreSame(typeof(int), subst.Visit(typeof(int)));
            Assert.AreEqual(typeof(long[]), subst.Visit(typeof(int[])));
            Assert.AreSame(typeof(int[, ]), subst.Visit(typeof(int[, ])));
            Assert.AreSame(typeof(Func <int>), subst.Visit(typeof(Func <int>)));
            Assert.AreEqual(typeof(Func <bool, Func <object, long[]>, double>), subst.Visit(typeof(Func <bool, Func <object, int[]>, double>)));
            Assert.AreSame(typeof(int *), subst.Visit(typeof(int *)));
            Assert.AreSame(typeof(int).MakeByRefType(), subst.Visit(typeof(int).MakeByRefType()));
        }
 public void TypeSubstitutor_ArgumentChecks()
 {
     Assert.ThrowsException <ArgumentNullException>(() => _ = new TypeSubstitutor(map: null));
 }
        public TypeSubstitutionExpressionVisitor(TypeSubstitutor typeSubstitutor)
#endif
        {
            _subst = typeSubstitutor ?? throw new ArgumentNullException(nameof(typeSubstitutor));
        }
        /// <summary>
        /// Creates a new type substitution expression visitor with the specified type substitutor.
        /// </summary>
        /// <param name="typeSubstitutor">Type substitutor to map source types onto target types.</param>
#if USE_SLIM
        public TypeSubstitutionExpressionSlimVisitor(TypeSubstitutor typeSubstitutor)
 /// <summary>
 /// Creates a new type substitution query expression visitor with the specified type substitutor.
 /// </summary>
 /// <param name="typeSubstitutor">Type substitutor to map source types onto target types.</param>
 public TypeSubstitutionQueryVisitor(TypeSubstitutor typeSubstitutor)
 {
     _subst = typeSubstitutor ?? throw new ArgumentNullException(nameof(typeSubstitutor));
     _lambdaBodyConverter = new TypeSubstitutionExpressionVisitor(_subst);
 }