1
0
mirror of https://github.com/ZetaKebab/MpcNET.git synced 2025-07-18 13:37:36 +00:00

Restructured commands

This commit is contained in:
Kim Hugener-Ohlsen
2018-09-04 19:45:21 +02:00
parent 1f59105d4e
commit 393df7ca9a
95 changed files with 4733 additions and 1045 deletions

View File

@ -13,7 +13,7 @@
[DataRow("_My Playlist", 5)]
public async Task ListPlaylistTest(string playlistName, int numberOfFiles)
{
var response = await Mpc.SendAsync(commands => commands.StoredPlaylist.GetContent(playlistName));
var response = await Mpc.SendAsync(new Commands.Playlist.ListPlaylistCommand(playlistName));
TestOutput.WriteLine($"ListPlaylistTest (playlistName: {playlistName}) Result:");
TestOutput.WriteLine(response);
@ -27,7 +27,7 @@
[DataRow("_My Playlist", 5)]
public async Task ListPlaylistInfoTest(string playlistName, int numberOfFiles)
{
var response = await Mpc.SendAsync(commands => commands.StoredPlaylist.GetContentWithMetadata(playlistName));
var response = await Mpc.SendAsync(new Commands.Playlist.ListPlaylistInfoCommand(playlistName));
TestOutput.WriteLine($"ListPlaylistTest (playlistName: {playlistName}) Result:");
TestOutput.WriteLine(response);
@ -41,7 +41,7 @@
[TestMethod]
public async Task ListPlaylistsTest()
{
var response = await Mpc.SendAsync(commands => commands.StoredPlaylist.GetAll());
var response = await Mpc.SendAsync(new Commands.Playlist.ListPlaylistsCommand());
TestOutput.WriteLine($"ListPlaylistsTest Result:");
TestOutput.WriteLine(response);
@ -117,57 +117,57 @@
private async Task Check_Empty_Queue()
{
var message = await Mpc.SendAsync(commands => commands.CurrentPlaylist.GetAllSongsInfo());
var message = await Mpc.SendAsync(new Commands.Playlist.PlaylistCommand());
Assert.IsTrue(message.HasSuccessResponse());
Assert.IsFalse(message.Response.Content.Any());
}
private async Task Load_Playlist(string playlistName)
{
var message = await Mpc.SendAsync(commands => commands.StoredPlaylist.Load(playlistName));
var message = await Mpc.SendAsync(new Commands.Playlist.LoadCommand(playlistName));
Assert.IsTrue(message.HasSuccessResponse());
}
private async Task Clear_Queue()
{
var message = await Mpc.SendAsync(commands => commands.CurrentPlaylist.Clear());
var message = await Mpc.SendAsync(new Commands.Playlist.ClearCommand());
Assert.IsTrue(message.HasSuccessResponse());
}
private async Task Check_Queue_HasSongs(int nrOfSongs)
{
var message = await Mpc.SendAsync(commands => commands.CurrentPlaylist.GetAllSongsInfo());
var message = await Mpc.SendAsync(new Commands.Playlist.PlaylistCommand());
Assert.IsTrue(message.HasSuccessResponse());
Assert.IsTrue(message.Response.Content.Count() == nrOfSongs);
}
private async Task Add_Directory(string directory)
{
var message = await Mpc.SendAsync(commands => commands.CurrentPlaylist.AddDirectory(directory));
var message = await Mpc.SendAsync(new Commands.Playlist.AddCommand(directory));
Assert.IsTrue(message.HasSuccessResponse());
}
private async Task Add_File(string file)
{
var message = await Mpc.SendAsync(commands => commands.CurrentPlaylist.AddSong(file));
var message = await Mpc.SendAsync(new Commands.Playlist.AddIdCommand(file));
Assert.IsTrue(message.HasSuccessResponse());
}
private async Task Remove_Position(int position)
{
var message = await Mpc.SendAsync(commands => commands.CurrentPlaylist.RemoveSongByPosition(position));
var message = await Mpc.SendAsync(new Commands.Playlist.DeleteCommand(position));
Assert.IsTrue(message.HasSuccessResponse());
}
private async Task Remove_Id(int songId)
{
var message = await Mpc.SendAsync(commands => commands.CurrentPlaylist.RemoveSongById(songId));
var message = await Mpc.SendAsync(new Commands.Playlist.DeleteIdCommand(songId));
Assert.IsTrue(message.HasSuccessResponse());
}
private async Task<int> Get_Song_Id()
{
var message = await Mpc.SendAsync(commands => commands.CurrentPlaylist.GetAllSongMetadata());
var message = await Mpc.SendAsync(new Commands.Playlist.PlaylistInfoCommand());
return message.Response.Content.Single().Id;
}
}