mirror of
https://github.com/ZetaKebab/MpcNET.git
synced 2025-07-18 05:27:37 +00:00
Major refactoring
This commit is contained in:
@ -1,10 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace MpcNET.Test
|
||||
namespace MpcNET.Test
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
[TestClass]
|
||||
public partial class LibMpcTest
|
||||
{
|
||||
@ -25,29 +25,34 @@ namespace MpcNET.Test
|
||||
_mpdMock.Dispose();
|
||||
}
|
||||
|
||||
internal static Mpc Mpc { get; private set; }
|
||||
internal static MpcConnection Mpc { get; private set; }
|
||||
|
||||
private static async Task SendCommand(string command)
|
||||
{
|
||||
var response = await Mpc.SendAsync(new PassthroughCommand(command));
|
||||
var response = await Mpc.SendAsync(_ => new PassthroughCommand(command));
|
||||
TestOutput.WriteLine(response);
|
||||
}
|
||||
private static async Task SendCommand<T>(IMpcCommand<T> command)
|
||||
{
|
||||
var response = await Mpc.SendAsync(command);
|
||||
var response = await Mpc.SendAsync(_ => command);
|
||||
TestOutput.WriteLine(response);
|
||||
}
|
||||
|
||||
private class PassthroughCommand : IMpcCommand<IList<string>>
|
||||
{
|
||||
private readonly string command;
|
||||
|
||||
public PassthroughCommand(string command)
|
||||
{
|
||||
Value = command;
|
||||
this.command = command;
|
||||
}
|
||||
|
||||
public string Value { get; }
|
||||
public string Serialize()
|
||||
{
|
||||
return this.command;
|
||||
}
|
||||
|
||||
public IList<string> FormatResponse(IList<KeyValuePair<string, string>> response)
|
||||
public IList<string> Deserialize(IReadOnlyList<KeyValuePair<string, string>> response)
|
||||
{
|
||||
var result = response.Select(atrb => $"{atrb.Key}: {atrb.Value}").ToList();
|
||||
return result;
|
||||
|
Reference in New Issue
Block a user