public void SendMessageOrStartApplication_PipeFailsThreeTimes_SuccessOnThirdTry() { var expectedMessage = "My Message"; var starter = BuildMaybePipedApplicationStarter(5); _pipeServerManager.IsServerRunning().Returns(true); _pipeServerManager.TrySendPipeMessage(expectedMessage) .Returns(false, false, false, true); starter.SendMessageOrStartApplication(() => expectedMessage, () => false, false); _pipeServerManager.Received(4).TrySendPipeMessage(expectedMessage); }
private bool TrySendPipeMessage(string message) { _logger.Debug("Found another running instance of PDFCreator, so we send our data there"); if (_pipeServerManager.TrySendPipeMessage(message)) { _logger.Debug("Pipe message successfully sent"); return(true); } _logger.Warn("There was an error while communicating through the pipe"); return(false); }