Пример #1
0
        public async Task Announce_StoppedEvent_Timeout()
        {
            TrackerManager.AddTracker("http://1.1.1.1");
            TrackerManager.ResponseDelay = TimeSpan.FromMinutes(1);

            var mode = new StoppingMode(Manager, DiskManager, ConnectionManager, Settings);

            Manager.Mode = mode;
            await mode.WaitForStoppingToComplete(TimeSpan.FromMilliseconds(1)).WithTimeout("Should've bailed");

            Assert.AreEqual(0, TrackerManager.Announces.Count, "#1");
        }
Пример #2
0
        public async Task DisposeActiveConnections()
        {
            Manager.Peers.ConnectedPeers.Add(Peer);
            Assert.IsFalse(Peer.Disposed, "#1");

            var mode = new StoppingMode(Manager, DiskManager, ConnectionManager, Settings);

            Manager.Mode = mode;
            await mode.WaitForStoppingToComplete();

            Assert.IsTrue(Peer.Disposed, "#2");
            Assert.AreEqual(0, Manager.Peers.AvailablePeers.Count, "#3");
        }
Пример #3
0
        public async Task Announce_StoppedEvent()
        {
            TrackerManager.AddTracker("http://1.1.1.1");

            var mode = new StoppingMode(Manager, DiskManager, ConnectionManager, Settings);

            Manager.Mode = mode;
            await mode.WaitForStoppingToComplete();

            Assert.AreEqual(1, TrackerManager.Announces.Count, "#1");
            Assert.AreEqual(TrackerManager.CurrentTracker, TrackerManager.Announces[0].Item1, "#2");
            Assert.AreEqual(TorrentEvent.Stopped, TrackerManager.Announces[0].Item2, "#3");
        }