mirror of
https://github.com/ZetaKebab/MpcNET.git
synced 2025-07-01 08:47:36 +00:00
Use only one Client and one Server for all Tests. Output tests.
This commit is contained in:
33
LibMpcTest/Tests/DatabaseCommandsTest.cs
Normal file
33
LibMpcTest/Tests/DatabaseCommandsTest.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Xunit;
|
||||
using System.Linq;
|
||||
using LibMpc;
|
||||
|
||||
namespace LibMpcTest
|
||||
{
|
||||
public partial class LibMpcTest
|
||||
{
|
||||
[Fact]
|
||||
public async Task ListAllTest()
|
||||
{
|
||||
var response = await Mpc.SendAsync(new Commands.Database.ListAll());
|
||||
|
||||
TestUtils.WriteLine("ListAllTest Result:");
|
||||
TestUtils.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
||||
|
||||
Assert.True(response.Response.Body.Count().Equals(7));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task FindGenreTest()
|
||||
{
|
||||
var response = await Mpc.SendAsync(new Commands.Database.Find(MpdTags.Genre, "soundfx"));
|
||||
|
||||
TestUtils.WriteLine("FindGenreTest Result:");
|
||||
TestUtils.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
||||
|
||||
Assert.True(response.Response.Body.Count().Equals(6));
|
||||
}
|
||||
}
|
||||
}
|
59
LibMpcTest/Tests/OutputCommandsTest.cs
Normal file
59
LibMpcTest/Tests/OutputCommandsTest.cs
Normal file
@ -0,0 +1,59 @@
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Xunit;
|
||||
using LibMpc;
|
||||
using System.Linq;
|
||||
|
||||
namespace LibMpcTest
|
||||
{
|
||||
public partial class LibMpcTest
|
||||
{
|
||||
[Fact]
|
||||
public async Task DisableOutputTest()
|
||||
{
|
||||
var responseOutputs = await Mpc.SendAsync(new Commands.Output.Outputs());
|
||||
Assert.True(responseOutputs.Response.Body.Single(output => output.Id.Equals(2)).IsEnabled);
|
||||
|
||||
var response = await Mpc.SendAsync(new Commands.Output.DisableOutput(2));
|
||||
|
||||
TestUtils.WriteLine("DisableOutputTest Result:");
|
||||
TestUtils.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
||||
|
||||
Assert.True(response.Response.Body.Equals(string.Empty));
|
||||
Assert.True(response.Response.State.Status.Equals("OK"));
|
||||
|
||||
responseOutputs = await Mpc.SendAsync(new Commands.Output.Outputs());
|
||||
Assert.False(responseOutputs.Response.Body.Single(output => output.Id.Equals(2)).IsEnabled);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task EnableOutputTest()
|
||||
{
|
||||
var responseOutputs = await Mpc.SendAsync(new Commands.Output.Outputs());
|
||||
// By default should be disable from mpd.config
|
||||
Assert.False(responseOutputs.Response.Body.Single(output => output.Id.Equals(1)).IsEnabled);
|
||||
|
||||
var response = await Mpc.SendAsync(new Commands.Output.EnableOutput(1));
|
||||
|
||||
TestUtils.WriteLine("EnableOutputTest Result:");
|
||||
TestUtils.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
||||
|
||||
Assert.True(response.Response.Body.Equals(string.Empty));
|
||||
Assert.True(response.Response.State.Status.Equals("OK"));
|
||||
|
||||
responseOutputs = await Mpc.SendAsync(new Commands.Output.Outputs());
|
||||
Assert.True(responseOutputs.Response.Body.Single(output => output.Id.Equals(1)).IsEnabled);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task LisOutputsTest()
|
||||
{
|
||||
var response = await Mpc.SendAsync(new Commands.Output.Outputs());
|
||||
|
||||
TestUtils.WriteLine("LisOutputsTest Result:");
|
||||
TestUtils.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
||||
|
||||
Assert.True(response.Response.Body.Count().Equals(3));
|
||||
}
|
||||
}
|
||||
}
|
22
LibMpcTest/Tests/ReflectionCommandsTest.cs
Normal file
22
LibMpcTest/Tests/ReflectionCommandsTest.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Xunit;
|
||||
using LibMpc;
|
||||
using System.Linq;
|
||||
|
||||
namespace LibMpcTest
|
||||
{
|
||||
public partial class LibMpcTest
|
||||
{
|
||||
[Fact]
|
||||
public async Task TagTypesTest()
|
||||
{
|
||||
var response = await Mpc.SendAsync(new Commands.Reflection.TagTypes());
|
||||
|
||||
TestUtils.WriteLine("TagTypesTest Result:");
|
||||
TestUtils.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
||||
|
||||
Assert.True(response.Response.Body.Count().Equals(17));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user