1
0
mirror of https://github.com/ZetaKebab/MpcNET.git synced 2024-09-16 05:30:09 +00:00
MpcNET/Sources/MpcNET.Test/MpcMock.cs
Kim Hugener-Ohlsen 12ddc4bca4 Major refactoring
2018-05-18 15:14:20 +02:00

26 lines
715 B
C#

namespace MpcNET.Test
{
using System;
using System.Net;
using System.Threading.Tasks;
public class MpcMock : IDisposable
{
public MpcMock()
{
var mpdEndpoint = new IPEndPoint(IPAddress.Loopback, 6600);
this.Client = new MpcConnection(mpdEndpoint);
Task.Run(async () => await this.Client.ConnectAsync()).Wait();
TestOutput.WriteLine($"Connected to MPD Version: {this.Client.Version}");
}
public MpcConnection Client { get; }
public void Dispose()
{
this.Client?.DisconnectAsync().GetAwaiter().GetResult();
TestOutput.WriteLine($"Disconnected from MPD.");
}
}
}