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

67 lines
2.8 KiB
C#
Raw Normal View History

using System.Threading.Tasks;
using Newtonsoft.Json;
using Xunit;
using LibMpc;
using System.Linq;
namespace LibMpcTest
{
public partial class LibMpcTest
{
2016-12-20 10:19:26 +00:00
[Fact]
public async Task CommandsTest()
{
var response = await Mpc.SendAsync(new Commands.Reflection.Commands());
TestOutput.WriteLine($"CommandsTest (commands: {response.Response.Body.Count()}) Result:");
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
2016-12-20 10:26:42 +00:00
// Different answer from MPD on Windows and on Linux, beacuse of Version.
2016-12-20 11:04:59 +00:00
// Check some of the commands.
Assert.True(response.Response.Body.Any(command => command.Equals("listall")));
Assert.True(response.Response.Body.Any(command => command.Equals("outputs")));
Assert.True(response.Response.Body.Any(command => command.Equals("pause")));
Assert.True(response.Response.Body.Any(command => command.Equals("play")));
Assert.True(response.Response.Body.Any(command => command.Equals("setvol")));
Assert.True(response.Response.Body.Any(command => command.Equals("stop")));
2016-12-20 10:19:26 +00:00
}
[Fact]
public async Task TagTypesTest()
{
var response = await Mpc.SendAsync(new Commands.Reflection.TagTypes());
2016-12-20 10:03:28 +00:00
TestOutput.WriteLine("TagTypesTest Result:");
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
Assert.True(response.Response.Body.Count().Equals(17));
}
[Fact]
public async Task UrlHandlersTest()
{
var response = await Mpc.SendAsync(new Commands.Reflection.UrlHandlers());
TestOutput.WriteLine($"UrlHandlersTest (handlers: {response.Response.Body.Count()}) Result:");
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
2016-12-20 11:04:59 +00:00
// Different answer from MPD on Windows and on Linux.
// Check some of the handlers.
Assert.True(response.Response.Body.Any(handler => handler.Equals("http://")));
Assert.True(response.Response.Body.Any(handler => handler.Equals("mms://")));
Assert.True(response.Response.Body.Any(handler => handler.Equals("gopher://")));
Assert.True(response.Response.Body.Any(handler => handler.Equals("rtp://")));
}
[Fact]
public async Task DecodersTest()
{
var response = await Mpc.SendAsync(new Commands.Reflection.Decoders());
TestOutput.WriteLine($"DecodersTest (decoders: {response.Response.Body.Count()}) Result:");
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
// TODO: Assert
}
}
}