2017-04-12 10:11:27 +00:00
|
|
|
namespace MpcNET.Test
|
2017-04-12 09:21:29 +00:00
|
|
|
{
|
2018-05-18 13:14:20 +00:00
|
|
|
using System.Linq;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
|
using MpcNET.Commands;
|
|
|
|
|
2017-04-12 09:21:29 +00:00
|
|
|
public partial class LibMpcTest
|
|
|
|
{
|
|
|
|
[TestMethod]
|
|
|
|
public async Task CommandsTest()
|
|
|
|
{
|
2018-09-04 17:45:21 +00:00
|
|
|
var response = await Mpc.SendAsync(new Commands.Reflection.CommandsCommand());
|
2017-04-12 09:21:29 +00:00
|
|
|
|
2018-05-18 13:14:20 +00:00
|
|
|
TestOutput.WriteLine($"CommandsTest (commands: {response.Response.Content.Count()}) Result:");
|
2017-04-13 09:25:19 +00:00
|
|
|
TestOutput.WriteLine(response);
|
2017-04-12 09:21:29 +00:00
|
|
|
|
|
|
|
// Different answer from MPD on Windows and on Linux, beacuse of Version.
|
|
|
|
// Check some of the commands.
|
2018-05-18 13:14:20 +00:00
|
|
|
Assert.IsTrue(response.Response.Content.Any(command => command.Equals("listall")));
|
|
|
|
Assert.IsTrue(response.Response.Content.Any(command => command.Equals("outputs")));
|
|
|
|
Assert.IsTrue(response.Response.Content.Any(command => command.Equals("pause")));
|
|
|
|
Assert.IsTrue(response.Response.Content.Any(command => command.Equals("play")));
|
|
|
|
Assert.IsTrue(response.Response.Content.Any(command => command.Equals("setvol")));
|
|
|
|
Assert.IsTrue(response.Response.Content.Any(command => command.Equals("stop")));
|
2017-04-12 09:21:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
public async Task TagTypesTest()
|
|
|
|
{
|
2018-09-04 17:45:21 +00:00
|
|
|
var response = await Mpc.SendAsync(new Commands.Reflection.TagTypesCommand());
|
2017-04-12 09:21:29 +00:00
|
|
|
|
|
|
|
TestOutput.WriteLine("TagTypesTest Result:");
|
2017-04-13 09:25:19 +00:00
|
|
|
TestOutput.WriteLine(response);
|
2017-04-12 09:21:29 +00:00
|
|
|
|
2021-10-03 15:53:58 +00:00
|
|
|
Assert.IsTrue(response.Response.Content.Count().Equals(25));
|
2017-04-12 09:21:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
public async Task UrlHandlersTest()
|
|
|
|
{
|
2018-09-04 17:45:21 +00:00
|
|
|
var response = await Mpc.SendAsync(new Commands.Reflection.UrlHandlersCommand());
|
2017-04-12 09:21:29 +00:00
|
|
|
|
2018-05-18 13:14:20 +00:00
|
|
|
TestOutput.WriteLine($"UrlHandlersTest (handlers: {response.Response.Content.Count()}) Result:");
|
2017-04-13 09:25:19 +00:00
|
|
|
TestOutput.WriteLine(response);
|
2017-04-12 09:21:29 +00:00
|
|
|
|
|
|
|
// Different answer from MPD on Windows and on Linux.
|
|
|
|
// Check some of the handlers.
|
2018-05-18 13:14:20 +00:00
|
|
|
Assert.IsTrue(response.Response.Content.Any(handler => handler.Equals("http://")));
|
2021-10-03 15:53:58 +00:00
|
|
|
Assert.IsTrue(response.Response.Content.Any(handler => handler.Equals("nfs://")));
|
2017-04-12 09:21:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
public async Task DecodersTest()
|
|
|
|
{
|
2018-09-04 17:45:21 +00:00
|
|
|
var response = await Mpc.SendAsync(new Commands.Reflection.DecodersCommand());
|
2017-04-12 09:21:29 +00:00
|
|
|
|
2018-05-18 13:14:20 +00:00
|
|
|
TestOutput.WriteLine($"DecodersTest (decoders: {response.Response.Content.Count()}) Result:");
|
2017-04-13 09:25:19 +00:00
|
|
|
TestOutput.WriteLine(response);
|
2017-04-12 09:21:29 +00:00
|
|
|
|
|
|
|
// Different answer from MPD on Windows and on Linux.
|
|
|
|
// Check some of the decoders.
|
2021-10-03 15:53:58 +00:00
|
|
|
Assert.IsTrue(response.Response.Content.Any(decoder => decoder.Name.Equals("vorbis")));
|
2018-05-18 13:14:20 +00:00
|
|
|
Assert.IsTrue(response.Response.Content.Any(decoder => decoder.Suffixes.Any(suffix => suffix.Equals("mp3"))));
|
|
|
|
Assert.IsTrue(response.Response.Content.Any(decoder => decoder.MediaTypes.Any(mediaType => mediaType.Equals("audio/mpeg"))));
|
|
|
|
Assert.IsTrue(response.Response.Content.Any(decoder => decoder.Name.Equals("flac")));
|
|
|
|
Assert.IsTrue(response.Response.Content.Any(decoder => decoder.Suffixes.Any(suffix => suffix.Equals("flac"))));
|
|
|
|
Assert.IsTrue(response.Response.Content.Any(decoder => decoder.MediaTypes.Any(mediaType => mediaType.Equals("audio/flac"))));
|
|
|
|
Assert.IsTrue(response.Response.Content.Any(decoder => decoder.MediaTypes.Any(mediaType => mediaType.Equals("audio/x-flac"))));
|
|
|
|
Assert.IsTrue(response.Response.Content.Any(decoder => decoder.Name.Equals("ffmpeg")));
|
|
|
|
Assert.IsTrue(response.Response.Content.Any(decoder => decoder.Suffixes.Any(suffix => suffix.Equals("aac"))));
|
|
|
|
Assert.IsTrue(response.Response.Content.Any(decoder => decoder.Suffixes.Any(suffix => suffix.Equals("mpeg"))));
|
|
|
|
Assert.IsTrue(response.Response.Content.Any(decoder => decoder.MediaTypes.Any(mediaType => mediaType.Equals("audio/aac"))));
|
|
|
|
Assert.IsTrue(response.Response.Content.Any(decoder => decoder.MediaTypes.Any(mediaType => mediaType.Equals("audio/mpeg"))));
|
2017-04-12 09:21:29 +00:00
|
|
|
}
|
|
|
|
}
|
2016-12-20 09:46:40 +00:00
|
|
|
}
|