public StrormConfigurationBuilder() { ICommunication communication = new StdInOutCommunication(); IOsSpecific osStuff = new WindowsPidStuff(); _outputToParent = new WriteStringWithEndTerminator(communication); _readerFormat = new JsonProtocolReaderFormat(new WritePidFileAndSendIdToParent(_writerFormat, osStuff, _outputToParent)); _readNext = new ReadUntillEndRecieved(communication); }
public void ShouldReadFromInStream() { Console.SetIn(new StringReader("hello")); var subjectUnderTest = new StdInOutCommunication(); var readLine = subjectUnderTest.ReadLine(); Assert.That(readLine, Is.EqualTo("hello")); }
public void ShouldOutputToError() { var emptyString = new StringBuilder(); Console.SetError(new StringWriter(emptyString)); var subjectUnderTest = new StdInOutCommunication(); subjectUnderTest.Error("error"); Assert.That(emptyString.ToString(), Is.EqualTo("error\r\n")); }
public void ShouldOutputOutStrem() { var emptyString = new StringBuilder(); Console.SetOut(new StringWriter(emptyString)); var subjectUnderTest = new StdInOutCommunication(); subjectUnderTest.WriteLine("hello"); subjectUnderTest.Flush(); Assert.That(emptyString.ToString(), Is.EqualTo("hello\r\n")); }