Пример #1
0
            public CreateData()
            {
                var baseOptions = new JsonRpcServerOptions().WithPipe(new Pipe());

                void BaseDelegate(JsonRpcServerOptions o)
                {
                    o.WithPipe(new Pipe());
                }

                var serviceProvider = new ServiceCollection().BuildServiceProvider();

                Add(new ActionDelegate("create: options", () => JsonRpcServer.Create(baseOptions)));
                Add(new ActionDelegate("create: options, serviceProvider", () => JsonRpcServer.Create(baseOptions, serviceProvider)));
                Add(new ActionDelegate("create: action", () => JsonRpcServer.Create(BaseDelegate)));
                Add(new ActionDelegate("create: action, serviceProvider", () => JsonRpcServer.Create(BaseDelegate, serviceProvider)));

                Add(new ActionDelegate("from: options", () => JsonRpcServer.From(baseOptions)));
                Add(new ActionDelegate("from: options, cancellationToken", () => JsonRpcServer.From(baseOptions, CancellationToken.None)));
                Add(new ActionDelegate("from: options, serviceProvider, cancellationToken", () => JsonRpcServer.From(baseOptions, serviceProvider, CancellationToken.None)));
                Add(new ActionDelegate("from: options, serviceProvider", () => JsonRpcServer.From(baseOptions, serviceProvider)));
                Add(new ActionDelegate("from: action", () => JsonRpcServer.From(BaseDelegate)));
                Add(new ActionDelegate("from: action, cancellationToken", () => JsonRpcServer.From(BaseDelegate, CancellationToken.None)));
                Add(new ActionDelegate("from: action, serviceProvider, cancellationToken", () => JsonRpcServer.From(BaseDelegate, serviceProvider, CancellationToken.None)));
                Add(new ActionDelegate("from: action, serviceProvider", () => JsonRpcServer.From(BaseDelegate, serviceProvider)));
            }
Пример #2
0
            public MissingOutputData()
            {
                var baseOptions = new JsonRpcServerOptions().WithInput(new Pipe().Reader);

                void BaseDelegate(JsonRpcServerOptions o)
                {
                    o.WithInput(new Pipe().Reader);
                }

                var serviceProvider = new ServiceCollection().BuildServiceProvider();

                Add(new ActionDelegate("create: options", () => JsonRpcServer.Create(baseOptions)));
                Add(new ActionDelegate("create: options, serviceProvider", () => JsonRpcServer.Create(baseOptions, serviceProvider)));
                Add(new ActionDelegate("create: action", () => JsonRpcServer.Create(BaseDelegate)));
                Add(new ActionDelegate("create: action, serviceProvider", () => JsonRpcServer.Create(BaseDelegate, serviceProvider)));
            }
Пример #3
0
 protected virtual void ConfigureServerInputOutput(PipeReader inMemoryReader, PipeWriter inMemoryWriter, JsonRpcServerOptions options)
 {
     options.WithInput(inMemoryReader).WithOutput(inMemoryWriter);
 }
 public static JsonRpcServerOptions WithSerializer(this JsonRpcServerOptions options, ISerializer serializer)
 {
     options.Serializer = serializer;
     return(options);
 }