本文整理汇总了C#中Playlist.Enqueue方法的典型用法代码示例。如果您正苦于以下问题:C# Playlist.Enqueue方法的具体用法?C# Playlist.Enqueue怎么用?C# Playlist.Enqueue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Playlist
的用法示例。
在下文中一共展示了Playlist.Enqueue方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PlaylistsCanGoBack
public void PlaylistsCanGoBack()
{
string filename1 = "song1";
string filename2 = "song1";
var music1 = new MusicInfo() { FullPath = filename1 };
var music2 = new MusicInfo() { FullPath = filename2 };
var dummyPlaylistWatcher = new DummyPlaylistWatcher();
var playlist = new Playlist(dummyPlaylistWatcher);
playlist.Enqueue(music1);
playlist.Enqueue(music2);
Assert.AreEqual(2, playlist.Count, "There must be two songs in the playlist.");
MusicInfo song = playlist.CurrentSong;
Assert.AreEqual(filename1, song.FullPath, "The first item in the playlist must be correct.");
playlist.MoveToNextSong();
MusicInfo nextSong = playlist.CurrentSong;
Assert.AreEqual(filename2, nextSong.FullPath, "The second item in the playlist must be correct.");
playlist.MoveBackOneSong();
Assert.AreEqual(filename1, playlist.CurrentSong.FullPath, "Going back one song should go back to the first one.");
}
示例2: PlayerCanGoBack
public void PlayerCanGoBack()
{
var playlist = new Playlist(new DummyPlaylistWatcher());
var dummyAudio = new DummyAudioInteractor();
var player = new Player(playlist, dummyAudio, null);
var song1 = new MusicInfo() { FullPath = "song1" };
var song2 = new MusicInfo() { FullPath = "song2" };
playlist.Enqueue(song1);
playlist.Enqueue(song2);
player.MaxPlayCount = 2;
player.Play();
Assert.AreEqual(1, playlist.CurrentPosition, "The song must have moved one song ahead.");
player.Back();
Assert.AreEqual(0, playlist.CurrentPosition, "The song must have moved one song back.");
}
示例3: PlayerShouldBePausableAndResumeable
public void PlayerShouldBePausableAndResumeable()
{
var playlist = new Playlist(new DummyPlaylistWatcher());
var dummyAudio = new DummyAudioInteractor();
var player = new Player(playlist, dummyAudio, null);
var song = "song1";
var music = new MusicInfo() { FullPath = song };
playlist.Enqueue(music);
player.Play();
player.Pause();
player.Resume();
Assert.IsTrue(dummyAudio.WasPaused, "The audio must have been paused.");
Assert.IsTrue(dummyAudio.WasResumed, "The audio must have been resumed.");
}
示例4: SimpleStart
public void SimpleStart()
{
string filename = "song1";
var music = new MusicInfo() { FullPath = filename};
var dummyPlaylistWatcher = new DummyPlaylistWatcher();
var playlist = new Playlist(dummyPlaylistWatcher);
playlist.Enqueue(music);
Assert.AreEqual(1, playlist.Count, "There must be one song in the playlist.");
MusicInfo song = playlist.CurrentSong;
playlist.CurrentSongIsStarting();
Assert.AreEqual(filename, song.FullPath, "The next song must be the one that was enqueued.");
Assert.AreEqual(1, dummyPlaylistWatcher.PlayHistory.Count, "Only one song must have been played.");
Assert.AreEqual(filename, dummyPlaylistWatcher.PlayHistory[0], "The song that played was ");
}
示例5: PlayerShouldBeStoppable
public void PlayerShouldBeStoppable()
{
var playlist = new Playlist(new DummyPlaylistWatcher());
var dummyAudio = new DummyAudioInteractor();
var player = new Player(playlist, dummyAudio, null);
var song = "song1";
var music = new MusicInfo() { FullPath = song };
playlist.Enqueue(music);
player.Play();
player.Stop();
Assert.IsTrue(dummyAudio.WasStopped, "It should stop.");
}
示例6: ResumingWhileNotPausedDoesNothing
public void ResumingWhileNotPausedDoesNothing()
{
var playlist = new Playlist(new DummyPlaylistWatcher());
var dummyAudio = new DummyAudioInteractor();
var player = new Player(playlist, dummyAudio, null);
var song = "song1";
var music = new MusicInfo() { FullPath = song };
playlist.Enqueue(music);
player.Play();
player.Resume();
Assert.IsFalse(dummyAudio.WasResumed, "It should not resume if it wasn't paused.");
}
示例7: PlayerShouldStopIfThePlaylistRunsOut
public void PlayerShouldStopIfThePlaylistRunsOut()
{
var playlist = new Playlist(new DummyPlaylistWatcher());
var dummyAudio = new DummyAudioInteractor();
var player = new Player(playlist, dummyAudio, null);
var song = "song1";
var music = new MusicInfo() { FullPath = song };
playlist.Enqueue(music);
player.Play();
Assert.AreEqual(1, dummyAudio.PlayHistory.Count, "There must be one song that was played.");
Assert.AreEqual(song, dummyAudio.PlayHistory[0], "The song that was played must be the right one.");
}
示例8: PlayerShouldPlayTheNextSongWhenTheSongFinishes
public void PlayerShouldPlayTheNextSongWhenTheSongFinishes()
{
var playlist = new Playlist(new DummyPlaylistWatcher());
var dummyAudio = new DummyAudioInteractor();
var player = new Player(playlist, dummyAudio, null);
var song1 = "song1";
var song2 = "song2";
var music1 = new MusicInfo() { FullPath = song1 };
var music2 = new MusicInfo() { FullPath = song2 };
playlist.Enqueue(music1);
playlist.Enqueue(music2);
player.Play();
Assert.AreEqual(2, dummyAudio.PlayHistory.Count, "There must be two songs that were played.");
Assert.AreEqual(song1, dummyAudio.PlayHistory[0], "The first song that was played must be the right one.");
Assert.AreEqual(song2, dummyAudio.PlayHistory[1], "The second song that was played must be the right one.");
}