Пример #1
0
 private KeyValuePair<string, HttpClient> CreateServer(IObservable<IEnumerable<Peer>> peerObservable, string nodeId)
 {
     var server = TestServer.Create(app =>
                                    {
                                        var startup = new StartUp();
                                        startup.ConfigureApplication(app, nodeId, peerObservable);
                                    });
     Trace.Listeners.RemoveAt(Trace.Listeners.Count - 1); //hack because Owin registers an extra trace listener and makes the log output double
     return new KeyValuePair<string, HttpClient>(nodeId, server.HttpClient);
 }
Пример #2
0
        private void CreateServer(Subject<IEnumerable<Peer>> peerObservable, string nodeId)
        {
            var server = TestServer.Create(app =>
                                           {
                                               var startup = new StartUp();
                                               startup.ConfigureApplication(app);
                                               startup.ConfigureAndStartRaft(nodeId, peerObservable);
                                           });
            Trace.Listeners.RemoveAt(Trace.Listeners.Count - 1);
            disposables.Add(server);
            httpClients.Add(server.HttpClient);

            clientsById.Add(new KeyValuePair<string, HttpClient>(nodeId, server.HttpClient));
        }