1
0
mirror of https://github.com/ZetaKebab/MpcNET.git synced 2024-09-16 05:30:09 +00:00
MpcNET/LibMpcTest/Tests/PlaylistsCommandsTest.cs

54 lines
2.2 KiB
C#
Raw Normal View History

2016-12-20 14:26:09 +00:00
using System.Threading.Tasks;
using Newtonsoft.Json;
using LibMpc;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
2016-12-20 14:26:09 +00:00
namespace LibMpcTest
{
public partial class LibMpcTest
{
[DataTestMethod]
[DataRow("Playlist One", 5)]
[DataRow("Playlist Two", 3)]
[DataRow("_My Playlist", 5)]
public async Task ListPlaylistTest(string playlistName, int numberOfFiles)
{
var response = await Mpc.SendAsync(new Commands.Playlists.Stored.ListPlaylist(playlistName));
TestOutput.WriteLine($"ListPlaylistTest (playlistName: {playlistName}) Result:");
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
Assert.IsTrue(response.Response.Body.Count().Equals(numberOfFiles));
}
[DataTestMethod]
[DataRow("Playlist One", 5)]
[DataRow("Playlist Two", 3)]
[DataRow("_My Playlist", 5)]
2017-01-30 10:52:35 +00:00
public async Task ListPlaylistInfoTest(string playlistName, int numberOfFiles)
{
var response = await Mpc.SendAsync(new Commands.Playlists.Stored.ListPlaylistInfo(playlistName));
TestOutput.WriteLine($"ListPlaylistTest (playlistName: {playlistName}) Result:");
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
Assert.IsTrue(response.Response.Body.Count().Equals(numberOfFiles));
Assert.IsTrue(response.Response.Body.All(item => !string.IsNullOrEmpty(item.Artist)));
Assert.IsTrue(response.Response.Body.All(item => !string.IsNullOrEmpty(item.Title)));
Assert.IsTrue(response.Response.Body.All(item => !string.IsNullOrEmpty(item.Date)));
2017-01-30 10:52:35 +00:00
}
[TestMethod]
2016-12-20 14:26:09 +00:00
public async Task ListPlaylistsTest()
{
var response = await Mpc.SendAsync(new Commands.Playlists.Stored.ListPlaylists());
TestOutput.WriteLine($"ListPlaylistsTest Result:");
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
Assert.IsTrue(response.Response.Body.Count().Equals(3));
2016-12-20 14:26:09 +00:00
}
}
}