Esempio n. 1
0
        public void WhereConditionIsCastable()
        {
            var pattern = new PatternGroup(new Pattern <IEnumerable <GFrom> >(), new Pattern <GTo>());

            pattern.AddWhereCondition(x => x.IsImplicitlyCastable <GFrom, GTo>());

            Assert.IsFalse(pattern.Matches(typeof(IEnumerable <int>), typeof(bool)));
            Assert.IsFalse(pattern.Matches(typeof(IEnumerable <int>), typeof(object)));
            Assert.IsTrue(pattern.Matches(typeof(IEnumerable <int>), typeof(double)));
        }
Esempio n. 2
0
        public void WhereConditionIsPrimitive()
        {
            var pattern = new PatternGroup(new Pattern <IEnumerable <GFrom> >(), new Pattern <GTo>());

            pattern.AddWhereCondition(x => x.IsPrimitive <GFrom>() && x.IsPrimitive <GTo>());

            Assert.IsTrue(pattern.Matches(typeof(IEnumerable <int>), typeof(bool)));
            Assert.IsFalse(pattern.Matches(typeof(IEnumerable <int>), typeof(object)));
            Assert.IsFalse(pattern.Matches(typeof(IEnumerable <object>), typeof(int)));
        }