static IEnumerable <SearcherItem> GetOperatorsFromType(Type type)
        {
            // We cannot support all the types because of PropertyFields (see ConstantEditorExtensions)
            // that is drawn to represent Criterion type
            if (!type.IsEnum && !k_SupportedTypes.Contains(type))
            {
                return(Enumerable.Empty <SearcherItem>());
            }

            return(TypeSystem.GetOverloadedBinaryOperators(type)
                   .Where(k => k_SupportedOperators.Contains(k))
                   .Select(o => new CriterionSearcherItem(o)));
        }
예제 #2
0
 public void TestGetOverloadedBinaryOperators_NoOverload(Type type)
 {
     Assert.IsFalse(TypeSystem.GetOverloadedBinaryOperators(type).Any());
 }
예제 #3
0
 public void TestGetOverloadedBinaryOperators_GetKind()
 {
     Assert.AreEqual(TypeSystem.GetOverloadedBinaryOperators(typeof(FakeBinaryOverload)).First(),
                     BinaryOperatorKind.Add);
 }
예제 #4
0
 public void GetOverloadedBinaryOperators(Type type)
 {
     Assert.IsTrue(TypeSystem.GetOverloadedBinaryOperators(type).Any());
 }
예제 #5
0
 public SearcherFilter WithBinaryOperators(Type type)
 {
     this.RegisterBinaryOperator(data => TypeSystem.GetOverloadedBinaryOperators(type).Contains(data.Kind));
     return(this);
 }