public void ShouldThowExceptionIfNullLinesRead()
 {
     var readLines = Substitute.For<ICommunication>();
     readLines.ReadLine().Returns(string.Empty);
     var subjectUnderTest = new ReadUntillEndRecieved(readLines);
     subjectUnderTest.Next();
 }
        public void ShouldReadAllLinesExceptTheEndString()
        {
            var readLines = Substitute.For<ICommunication>();
            readLines.ReadLine().Returns(
                JsonStrings.HandshakeMessageIn().First(),
                JsonStrings.HandshakeMessageIn().Skip(1).ToArray());
            var expected = JsonStrings.HandshakeMessageIn().WithoutEnd().ToSingleString();

            var subjectUnderTest = new ReadUntillEndRecieved(readLines);

            Assert.That(subjectUnderTest.Next(), Is.EqualTo(expected));
        }
        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);
        }