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:");
|
2017-04-13 09:25:19 +00:00
|
|
|
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:");
|
2017-04-13 09:25:19 +00:00
|
|
|
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:");
|
2017-04-13 09:25:19 +00:00
|
|
|
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:");
|
2017-04-13 09:25:19 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|
2016-12-20 09:46:40 +00:00
|
|
|
}
|