mirror of
https://github.com/ZetaKebab/MpcNET.git
synced 2025-07-01 16:47:37 +00:00
Output server log in test startup.
This commit is contained in:
@ -11,14 +11,19 @@ namespace LibMpcTest
|
|||||||
{
|
{
|
||||||
public class LibMpcTest : IClassFixture<MpdServerTest>, IDisposable
|
public class LibMpcTest : IClassFixture<MpdServerTest>, IDisposable
|
||||||
{
|
{
|
||||||
|
private readonly MpdServerTest _server;
|
||||||
private readonly ITestOutputHelper _output;
|
private readonly ITestOutputHelper _output;
|
||||||
private readonly Mpc _mpc;
|
private readonly Mpc _mpc;
|
||||||
|
|
||||||
public LibMpcTest(ITestOutputHelper output)
|
public LibMpcTest(MpdServerTest server, ITestOutputHelper output)
|
||||||
{
|
{
|
||||||
|
_server = server;
|
||||||
_output = output;
|
_output = output;
|
||||||
|
|
||||||
_mpc = new Mpc(new IPEndPoint(IPAddress.Loopback, 6600));
|
_mpc = new Mpc(new IPEndPoint(IPAddress.Loopback, 6600));
|
||||||
|
|
||||||
|
Console.WriteLine(_server.LogError);
|
||||||
|
|
||||||
var connected = _mpc.ConnectAsync().GetAwaiter().GetResult();
|
var connected = _mpc.ConnectAsync().GetAwaiter().GetResult();
|
||||||
if (connected)
|
if (connected)
|
||||||
{
|
{
|
||||||
|
@ -4,10 +4,8 @@ using System.IO;
|
|||||||
|
|
||||||
namespace LibMpcTest
|
namespace LibMpcTest
|
||||||
{
|
{
|
||||||
internal class MpdServerTest : IDisposable
|
public class MpdServerTest : IDisposable
|
||||||
{
|
{
|
||||||
private Process _process;
|
|
||||||
|
|
||||||
public MpdServerTest()
|
public MpdServerTest()
|
||||||
{
|
{
|
||||||
var serverPath = Path.Combine(AppContext.BaseDirectory, "Server");
|
var serverPath = Path.Combine(AppContext.BaseDirectory, "Server");
|
||||||
@ -17,7 +15,7 @@ namespace LibMpcTest
|
|||||||
var mpdExePath = Path.Combine(serverPath, "mpd.exe");
|
var mpdExePath = Path.Combine(serverPath, "mpd.exe");
|
||||||
var mpdConfPath = Path.Combine(serverPath, "mpd.conf");
|
var mpdConfPath = Path.Combine(serverPath, "mpd.conf");
|
||||||
|
|
||||||
_process = new Process
|
Process = new Process
|
||||||
{
|
{
|
||||||
StartInfo = new ProcessStartInfo
|
StartInfo = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
@ -31,16 +29,19 @@ namespace LibMpcTest
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_process.Start();
|
Process.Start();
|
||||||
var logOutput = _process.StandardOutput.ReadToEnd();
|
LogOutput = Process.StandardOutput.ReadToEnd();
|
||||||
var logError = _process.StandardError.ReadToEnd();
|
LogError = Process.StandardError.ReadToEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Process Process { get; }
|
||||||
|
public string LogError { get; }
|
||||||
|
public string LogOutput { get; }
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_process?.Kill();
|
Process?.Kill();
|
||||||
_process?.Dispose();
|
Process?.Dispose();
|
||||||
_process = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user