Exemple #1
0
        private void GivenThePeersAre(List <FilePeer> peers)
        {
            FilePeers filePeers = new FilePeers();

            filePeers.Peers.AddRange(peers);
            var json = JsonConvert.SerializeObject(filePeers);

            File.WriteAllText("peers.json", json);
        }
Exemple #2
0
        private void GivenFiveServersAreRunning()
        {
            var bytes = File.ReadAllText("peers.json");

            _peers = JsonConvert.DeserializeObject <FilePeers>(bytes);

            foreach (var peer in _peers.Peers)
            {
                var thread = new Thread(() => GivenAServerIsRunning(peer.HostAndPort));
                thread.Start();
                _threads.Add(thread);
            }
        }