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))); }
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))); }