public void Teardown()
        {
            DhtEngineFactory.Creator = listener => new DhtEngine(listener);

            rig.Dispose();
            conn.Dispose();
        }
Example #2
0
        public void ReregisterManager()
        {
            ManualResetEvent handle = new ManualResetEvent(false);

            rig.Manager.TorrentStateChanged += delegate(object sender, TorrentStateChangedEventArgs e)
            {
                if (e.OldState == TorrentState.Hashing)
                {
                    handle.Set();
                }
            };
            rig.Manager.HashCheck(false);

            handle.WaitOne();
            handle.Reset();

            rig.Engine.Unregister(rig.Manager);
            TestRig rig2 = TestRig.CreateMultiFile(new TestWriter());

            rig2.Engine.Unregister(rig2.Manager);
            rig.Engine.Register(rig2.Manager);
            rig2.Manager.TorrentStateChanged += delegate(object sender, TorrentStateChangedEventArgs e)
            {
                if (e.OldState == TorrentState.Hashing)
                {
                    handle.Set();
                }
            };
            rig2.Manager.HashCheck(true);
            handle.WaitOne();
            rig2.Dispose();
        }
Example #3
0
        public async Task Teardown()
        {
            await rig.Manager.StopAsync();

            pair.Dispose();
            rig.Dispose();
        }
        public async Task ReregisterManager()
        {
            var hashingTask = rig.Manager.WaitForState(TorrentState.Stopped);
            await rig.Manager.HashCheckAsync(false);

            await hashingTask;

            await rig.Engine.Unregister(rig.Manager);

            TestRig rig2 = TestRig.CreateMultiFile(new TestWriter());
            await rig2.Engine.Unregister(rig2.Manager);

            await rig.Engine.Register(rig2.Manager);

            hashingTask = rig2.Manager.WaitForState(TorrentState.Downloading);
            await rig2.Manager.HashCheckAsync(true);

            await hashingTask;
            await rig2.Manager.StopAsync();

            rig2.Dispose();
        }
Example #5
0
 public void GlobalTeardown()
 {
     rig.Dispose();
 }
Example #6
0
 public void TearDown()
 {
     rig.Dispose();
 }
Example #7
0
 public void FixtureTeardown()
 {
     rig.Dispose();
 }
Example #8
0
 public void Teardown()
 {
     rig.Manager.Stop();
     pair.Dispose();
     rig.Dispose();
 }
Example #9
0
 public void TearDown()
 {
     listener.Close();
     rig.Dispose();
 }
 public void Teardown()
 {
     rig?.Dispose();
 }
Example #11
0
 public void Teardown()
 {
     rig.Dispose();
     conn.Dispose();
 }
 public void Teardown()
 {
     handle.Close();
     rig.Dispose();
 }
Example #13
0
 public void FixtureTeardown()
 {
     testRig.Dispose();
 }
 public void GlobalTeardown()
 {
     testRig?.Dispose();
 }
Example #15
0
        public void ReregisterManager()
        {
            ManualResetEvent handle = new ManualResetEvent(false);
            rig.Manager.TorrentStateChanged += delegate(object sender, TorrentStateChangedEventArgs e)
            {
                if (e.OldState == TorrentState.Hashing)
                    handle.Set();
            };
            rig.Manager.HashCheck(false);

            handle.WaitOne();
            handle.Reset();

            rig.Engine.Unregister(rig.Manager);
            TestRig rig2 = new TestRig("", new TestWriter());
            rig2.Engine.Unregister(rig2.Manager);
            rig.Engine.Register(rig2.Manager);
            rig2.Manager.TorrentStateChanged += delegate(object sender, TorrentStateChangedEventArgs e)
            {
                if (e.OldState == TorrentState.Hashing)
                    handle.Set();
            };
            rig2.Manager.HashCheck(true);
            handle.WaitOne();
            rig2.Dispose();
        }