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

"Commands" command created and tested

This commit is contained in:
glucaci 2016-12-20 11:19:26 +01:00
parent b7791ab26a
commit 36a4888789
2 changed files with 27 additions and 1 deletions

View File

@ -11,7 +11,22 @@ namespace LibMpc
public static class Reflection public static class Reflection
{ {
// TODO: config // TODO: config
// TODO: commands
/// <summary>
/// Shows which commands the current user has access to.
/// </summary>
public class Commands : IMpcCommand<IEnumerable<string>>
{
public string Value => "commands";
public IEnumerable<string> FormatResponse(IList<KeyValuePair<string, string>> response)
{
var result = response.Where(item => item.Key.Equals("command")).Select(item => item.Value);
return result;
}
}
// TODO: notcommands // TODO: notcommands
public class TagTypes : IMpcCommand<IEnumerable<string>> public class TagTypes : IMpcCommand<IEnumerable<string>>

View File

@ -8,6 +8,17 @@ namespace LibMpcTest
{ {
public partial class LibMpcTest public partial class LibMpcTest
{ {
[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));
Assert.True(response.Response.Body.Count().Equals(84));
}
[Fact] [Fact]
public async Task TagTypesTest() public async Task TagTypesTest()
{ {