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;
|
|
|
|
using System.Net;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
2017-04-12 09:21:29 +00:00
|
|
|
public class MpcMock : IDisposable
|
|
|
|
{
|
|
|
|
public MpcMock()
|
|
|
|
{
|
2017-04-12 11:35:47 +00:00
|
|
|
var mpdEndpoint = new IPEndPoint(IPAddress.Loopback, 6600);
|
2018-05-18 13:14:20 +00:00
|
|
|
this.Client = new MpcConnection(mpdEndpoint);
|
2017-04-12 09:21:29 +00:00
|
|
|
|
2018-05-18 13:14:20 +00:00
|
|
|
Task.Run(async () => await this.Client.ConnectAsync()).Wait();
|
|
|
|
TestOutput.WriteLine($"Connected to MPD Version: {this.Client.Version}");
|
2017-04-12 09:21:29 +00:00
|
|
|
}
|
|
|
|
|
2018-05-18 13:14:20 +00:00
|
|
|
public MpcConnection Client { get; }
|
2017-04-12 09:21:29 +00:00
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
{
|
2018-05-18 13:14:20 +00:00
|
|
|
this.Client?.DisconnectAsync().GetAwaiter().GetResult();
|
2017-04-12 09:21:29 +00:00
|
|
|
TestOutput.WriteLine($"Disconnected from MPD.");
|
|
|
|
}
|
|
|
|
}
|
2016-12-20 09:46:40 +00:00
|
|
|
}
|