/// <summary> /// Returns a RemoteFile, which calls the process raising ErrorDataReceived. /// </summary> /// <param name="task">Cancelable operation to associate with /// (responsible for the progressbar and cancellation handling).</param> /// <param name="error">Error message.</param> /// <returns>Pre-configured RemoteFile.</returns> RemoteFile PrepareRemoteFileInstanceWithError(ICancelable task, string error) { var process = new TestProcess(task, errorMessage: error); _managedProcessFactory.Create(Arg.Any <ProcessStartInfo>(), Arg.Any <int>()) .Returns(process); return(new RemoteFile(_managedProcessFactory)); }
/// <summary> /// Returns a RemoteFile, which calls the process sequentially raising /// OutputDataReceived events with the prepared content (output). /// </summary> /// <param name="task">Cancelable operation to associate with /// (responsible for the progressbar and cancellation handling).</param> /// <param name="output">Lines `produced` by the mock process.</param> /// <returns>Pre-configured RemoteFile.</returns> RemoteFile PrepareRemoteFileInstanceWithOutput(ICancelable task, List <string> output) { var process = new TestProcess(task, output); _managedProcessFactory.Create(Arg.Any <ProcessStartInfo>(), Arg.Any <int>()) .Returns(process); return(new RemoteFile(_managedProcessFactory)); }
/// <summary> /// Returns a RemoteFile, which calls the process raising OutputDataReceived /// event once and sets the underlying task into `Canceled` state. /// </summary> /// <param name="task">Cancelable operation to associate with /// (responsible for the progressbar and cancellation handling).</param> /// <param name="singleLine">Line `produced` by the mock process before being /// cancelled.</param> /// <returns>Pre-configured RemoteFile.</returns> RemoteFile PrepareRemoteFileInstanceCanceledAfterFirstOutput(ICancelable task, string singleLine) { var process = new TestProcess(task, new List <string>() { singleLine }, cancels: true); _managedProcessFactory.Create(Arg.Any <ProcessStartInfo>(), Arg.Any <int>()) .Returns(process); return(new RemoteFile(_managedProcessFactory)); }