public void ShouldWriteToError()
        {
            const string error = "error!";
            var rawWriter = Substitute.For<ICommunication>();

            var subjectUnderTest = new WriteStringWithEndTerminator(rawWriter);
            subjectUnderTest.AlternativeErrorStream(error);

            rawWriter.Received().Error(error);
        }
        public void ShouldWriteStuffWithAnEnd()
        {
            var json = JsonStrings.CommandAckOut();
            var rawWriter = Substitute.For<ICommunication>();

            var subjectUnderTest = new WriteStringWithEndTerminator(rawWriter);
            subjectUnderTest.Write(json);

            rawWriter.Received().WriteLine(json);
            rawWriter.Received().WriteLine("end");
            rawWriter.Received().Flush();
        }
        public void SetUp()
        {
            var dataSource = new TestBoltDataSource();
            _communication = new ProvidedStreamCommunication(dataSource);

            var writerFormat = new JsonProtocolWriterFormat();
            var outputToParent = new WriteStringWithEndTerminator(_communication);

            var osStuff = Substitute.For<IOsSpecific>();
            osStuff.GetProcessId().Returns(1234);
            var readerFormat = new JsonProtocolReaderFormat(new WritePidFileAndSendIdToParent(writerFormat, osStuff, outputToParent));
            var readNext = new ReadUntillEndRecieved(_communication);
            var stormReader = new StormReader(readNext, readerFormat);
            var stormWriter = new StandardBoltWriter(outputToParent, writerFormat, stormReader);
            _bolt = new SplitSentence(stormReader, stormWriter);
        }