public async Task StopTwice ()
 {
     var provider = new StreamProvider (Engine, "testDir", Torrent);
     await provider.StartAsync ();
     await provider.StopAsync ();
     Assert.ThrowsAsync<InvalidOperationException> (() => provider.StopAsync ());
 }
 public async Task StopNormally ()
 {
     var provider = new StreamProvider (Engine, "testDir", Torrent);
     await provider.StartAsync ();
     await provider.StopAsync ();
     Assert.IsEmpty (Engine.Torrents);
 }
        public async Task WaitForMetadata_Cancellation ()
        {
            var provider = new StreamProvider (Engine, "testDir", MagnetLink, "magnetDir");
            await provider.StartAsync ();

            var metadataTask = provider.WaitForMetadataAsync ();
            await provider.StopAsync ();
            Assert.ThrowsAsync<TaskCanceledException> (() => metadataTask);
        }