public void AnnounceAddAndRemovePeerTest() { Manager.StartListening(); Peer1.StartListening(); Peer2.StartListening(); Peer3.StartListening(); Peer4.StartListening(); Assert.That(!Manager.Peers.ContainsKey(Peer4.Address) && !Peer1.Peers.ContainsKey(Peer4.Address) && !Peer2.Peers.ContainsKey(Peer4.Address) && !Peer3.Peers.ContainsKey(Peer4.Address)); Manager.AnnounceAddPeer(Peer4.Address, Peer4.Crypto.Keys.Item1); Manager.AddPeer(Peer4.Address, Peer4.Crypto.Keys.Item1); Thread.Sleep(3000); Assert.That(Manager.Peers.ContainsKey(Peer4.Address) && Peer1.Peers.ContainsKey(Peer4.Address) && Peer2.Peers.ContainsKey(Peer4.Address) && Peer3.Peers.ContainsKey(Peer4.Address)); Manager.AnnounceRemovePeer(Peer4.Address); Thread.Sleep(3000); Assert.That(!Manager.Peers.ContainsKey(Peer4.Address) && !Peer1.Peers.ContainsKey(Peer4.Address) && !Peer2.Peers.ContainsKey(Peer4.Address) && !Peer3.Peers.ContainsKey(Peer4.Address)); }
/// <summary> /// The tear down. /// </summary> [TearDown] public void TearDown() { Manager.Dispose(); Peer1.Dispose(); Peer2.Dispose(); Peer3.Dispose(); Peer4.Dispose(); Manager = null; Peer1 = null; Peer2 = null; Peer3 = null; Peer4 = null; File.Delete("StationTestsManagerVoters.sqlite"); File.Delete("StationTestsPeer1Voters.sqlite"); File.Delete("StationTestsPeer2Voters.sqlite"); File.Delete("StationTestsPeer3Voters.sqlite"); File.Delete("StationTestsPeer4Voters.sqlite"); File.Delete("StationsTestsManagerLog.sqlite"); File.Delete("StationsTestsPeer1Log.sqlite"); File.Delete("StationsTestsPeer2Log.sqlite"); File.Delete("StationsTestsPeer3Log.sqlite"); File.Delete("StationsTestsPeer4Log.sqlite"); }