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

75 lines
3.0 KiB
C#
Raw Normal View History

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;
2017-04-12 09:21:29 +00:00
public partial class LibMpcTest
{
[TestMethod]
public async Task DisableOutputTest()
{
2018-09-04 17:45:21 +00:00
var responseOutputs = await Mpc.SendAsync(new Commands.Output.OutputsCommand());
2018-05-18 13:14:20 +00:00
Assert.IsTrue(responseOutputs.Response.Content.Single(output => output.Id.Equals(0)).IsEnabled);
2017-04-12 09:21:29 +00:00
2018-09-04 17:45:21 +00:00
var response = await Mpc.SendAsync(new Commands.Output.DisableOutputCommand(0));
2017-04-12 09:21:29 +00:00
TestOutput.WriteLine("DisableOutputTest Result:");
TestOutput.WriteLine(response);
2017-04-12 09:21:29 +00:00
2018-05-18 13:14:20 +00:00
Assert.IsTrue(response.Response.Content.Equals(string.Empty));
Assert.IsTrue(response.Response.Result.Status.Equals("OK"));
2017-04-12 09:21:29 +00:00
2018-09-04 17:45:21 +00:00
responseOutputs = await Mpc.SendAsync(new Commands.Output.OutputsCommand());
2018-05-18 13:14:20 +00:00
Assert.IsFalse(responseOutputs.Response.Content.Single(output => output.Id.Equals(0)).IsEnabled);
2017-04-12 09:21:29 +00:00
}
[TestMethod]
public async Task EnableOutputTest()
{
2018-09-04 17:45:21 +00:00
var responseOutputs = await Mpc.SendAsync(new Commands.Output.OutputsCommand());
2017-04-12 09:21:29 +00:00
// By default should be disable from mpd.config
2018-05-18 13:14:20 +00:00
Assert.IsFalse(responseOutputs.Response.Content.Single(output => output.Id.Equals(1)).IsEnabled);
2017-04-12 09:21:29 +00:00
2018-09-04 17:45:21 +00:00
var response = await Mpc.SendAsync(new Commands.Output.EnableOutputCommand(1));
2017-04-12 09:21:29 +00:00
TestOutput.WriteLine("EnableOutputTest Result:");
TestOutput.WriteLine(response);
2017-04-12 09:21:29 +00:00
2018-05-18 13:14:20 +00:00
Assert.IsTrue(response.Response.Content.Equals(string.Empty));
Assert.IsTrue(response.Response.Result.Status.Equals("OK"));
2017-04-12 09:21:29 +00:00
2018-09-04 17:45:21 +00:00
responseOutputs = await Mpc.SendAsync(new Commands.Output.OutputsCommand());
2018-05-18 13:14:20 +00:00
Assert.IsTrue(responseOutputs.Response.Content.Single(output => output.Id.Equals(1)).IsEnabled);
2017-04-12 09:21:29 +00:00
}
[TestMethod]
public async Task ToggleOutputTest()
{
2018-09-04 17:45:21 +00:00
var responseOutputs = await Mpc.SendAsync(new Commands.Output.OutputsCommand());
2018-05-18 13:14:20 +00:00
Assert.IsTrue(responseOutputs.Response.Content.Single(output => output.Id.Equals(2)).IsEnabled);
2017-04-12 09:21:29 +00:00
2018-09-04 17:45:21 +00:00
var response = await Mpc.SendAsync(new Commands.Output.ToggleOutputCommand(2));
2017-04-12 09:21:29 +00:00
TestOutput.WriteLine("ToggleOutputTest Result:");
TestOutput.WriteLine(response);
2017-04-12 09:21:29 +00:00
2018-05-18 13:14:20 +00:00
Assert.IsTrue(response.Response.Content.Equals(string.Empty));
Assert.IsTrue(response.Response.Result.Status.Equals("OK"));
2017-04-12 09:21:29 +00:00
2018-09-04 17:45:21 +00:00
responseOutputs = await Mpc.SendAsync(new Commands.Output.OutputsCommand());
2018-05-18 13:14:20 +00:00
Assert.IsFalse(responseOutputs.Response.Content.Single(output => output.Id.Equals(2)).IsEnabled);
2017-04-12 09:21:29 +00:00
}
[TestMethod]
public async Task LisOutputsTest()
{
2018-09-04 17:45:21 +00:00
var response = await Mpc.SendAsync(new Commands.Output.OutputsCommand());
2017-04-12 09:21:29 +00:00
TestOutput.WriteLine("LisOutputsTest Result:");
TestOutput.WriteLine(response);
2017-04-12 09:21:29 +00:00
2018-05-18 13:14:20 +00:00
Assert.IsTrue(response.Response.Content.Count().Equals(3));
2017-04-12 09:21:29 +00:00
}
}
}