public void ShouldReadTaskIds()
        {
            var command = JsonStrings.TupleIn().WithoutEnd().ToSingleString();
            var taskIds = JsonStrings.TaskIdsIn().WithoutEnd().ToSingleString();

            var reader = Substitute.For <IReadNext>();

            reader.Next().Returns(taskIds);

            var format = FormatSubsitute(command, taskIds);

            var subjectUnderTest = new StormReader(reader, format);

            Assert.That(subjectUnderTest.ReadTaskIds(), Is.Not.Null);
        }
Пример #2
0
        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);
        }
        public void ShouldReturnHandshakeMessage()
        {
            var command = JsonStrings.HandshakeMessageIn().WithoutEnd().ToSingleString();

            var reader = Substitute.For <IReadNext>();

            reader.Next().Returns(command);

            var format       = Substitute.For <IProtocolReaderFormat>();
            var setupProcess = Substitute.For <ISetupProcess>();

            format.Handshake(command).Returns(new StormHandshake(setupProcess));

            var subjectUnderTest = new StormReader(reader, format);

            Assert.That(
                subjectUnderTest.ReadInitialHandshakeMessage(),
                Is.Not.Null);

            format.Received().Handshake(command);
            format.DidNotReceive().Handshake(null);
        }