1
0
mirror of https://github.com/ZetaKebab/MpcNET.git synced 2025-07-18 05:27:37 +00:00

Major refactoring

This commit is contained in:
Kim Hugener-Ohlsen
2018-05-18 15:14:20 +02:00
parent 245efd6477
commit 12ddc4bca4
99 changed files with 426 additions and 419 deletions

View File

@ -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;