public static IObjectFieldDescriptor UseSorting <T>(
            this IObjectFieldDescriptor descriptor,
            Action <ISortInputTypeDescriptor <T> > configure)
        {
            if (descriptor is null)
            {
                throw new ArgumentNullException(nameof(descriptor));
            }

            if (configure is null)
            {
                throw new ArgumentNullException(nameof(configure));
            }

            var sortType = new SortInputType <T>(configure);

            return(UseSorting(descriptor, sortType.GetType(), sortType));
        }
Пример #2
0
        protected ExecutorBuilder CreateProviderTester <TRuntimeType>(
            SortInputType <TRuntimeType> type,
            SortConvention?convention = null)
        {
            convention ??=
            new SortConvention(
                x => x.AddDefaults().BindRuntimeType(typeof(TRuntimeType), type.GetType()));

            ISchemaBuilder builder = SchemaBuilder.New()
                                     .AddConvention <ISortConvention>(convention)
                                     .TryAddTypeInterceptor <SortTypeInterceptor>()
                                     .AddQueryType(
                c =>
                c.Name("Query")
                .Field("foo")
                .Type <StringType>()
                .Resolver("bar"))
                                     .AddType(type);

            builder.Create();

            return(new ExecutorBuilder(type));
        }
Пример #3
0
 public SortingScenario(SortingAlgorithm sortingAlgorithm, int numElements, SortInputType sortInputType)
 {
     this.SortingAlgorithm = sortingAlgorithm;
     this.NumElements = numElements;
     this.SortInputType = sortInputType;
 }