public void Install_Throws() { var src = new Port("Dummy", "Dummy"); Assert.That(src.Exists, Is.False); src.Application = "Dummy"; src.Arguments = "Dummy"; src.Temp = @"Dummy\Path\To"; src.WaitForExit = true; Assert.That(src.CanInstall(), Is.True); Assert.That(() => src.Install(), Throws.InstanceOf <Exception>()); }
public bool Create(string name, string monitor, bool canInstall) { var src = new Port(name, monitor); Assert.That(src.Name, Is.EqualTo(name)); Assert.That(src.MonitorName, Is.EqualTo(monitor)); Assert.That(src.CanInstall(), Is.EqualTo(canInstall)); Assert.That(src.WaitForExit, Is.False, nameof(src.WaitForExit)); Assert.That(src.Environment.HasValue(), Is.True, nameof(src.Environment)); Assert.That(src.Application.HasValue(), Is.EqualTo(src.Exists), nameof(src.Application)); Assert.That(src.Arguments.HasValue(), Is.EqualTo(src.Exists), nameof(src.Arguments)); Assert.That(src.Temp.HasValue(), Is.EqualTo(src.Exists), nameof(src.Temp)); return(src.Exists); }
/* ----------------------------------------------------------------- */ /// /// Log /// /// <summary> /// Puts debug information to the log file. /// </summary> /// /// <param name="src">Port object.</param> /// <param name="method">Method name.</param> /// /* ----------------------------------------------------------------- */ public static void Log(this Port src, [CallerMemberName] string method = null) => src.Put( $"[{method}]", $"{nameof(src.Name)}:{src.Name.Quote()}", $"{nameof(src.Exists)}:{src.Exists}", $"{nameof(src.CanInstall)}:{src.CanInstall()}", $"{nameof(src.MonitorName)}:{src.MonitorName.Quote()}", $"{nameof(src.Environment)}:{src.Environment.Quote()}", $"{nameof(src.Application)}:{src.Application.Quote()}", $"{nameof(src.Proxy)}:{src.Proxy.Quote()}", $"{nameof(src.Arguments)}:[ {src.Arguments} ]", $"{nameof(src.Temp)}:{src.Temp.Quote()}", $"{nameof(src.WaitForExit)}:{src.WaitForExit}", $"{nameof(src.RunAsUser)}:{src.RunAsUser}" );