示例#1
0
	   public void LoadFile_ThenDispose_FileCanBeDeleted()
	   {
#if !MONO
		   var file = TempFile.FromResource(Resources._2Channel, ".wav");
		   using (var player = new AudioPlayer())
		   {
			   player.LoadFile(file.Path);
		   }
		   Assert.DoesNotThrow(() => File.Delete(file.Path));
#endif
		}
示例#2
0
	   public void PlayFile_ThenDispose_FileCanBeDeleted()
	   {
#if !MONO
		   var file = TempFile.FromResource(Resources._2Channel, ".wav");
		   using (var player = new AudioPlayer())
		   {
			   player.LoadFile(file.Path);
			   //player.Stopped += (s, e) => { Assert.DoesNotThrow(() => File.Delete(file.Path)); };

			   player.StartPlaying();
			   var giveUpTime = DateTime.Now.AddSeconds(3);
			   while (player.PlaybackState != PlaybackState.Stopped && DateTime.Now < giveUpTime)
				   Thread.Sleep(100);

		   }
		   Assert.DoesNotThrow(() => File.Delete(file.Path));
		   Assert.False(File.Exists(file.Path));
#endif
		}