Exemple #1
0
        public void ShouldHaveCorrectAcknowledgeString()
        {
            var subjectUnderTest = new JsonProtocolWriterFormat();

            Assert.That(subjectUnderTest.Acknowledge(1231231).TrimStuffForCompare(),
                        Is.EqualTo(JsonStrings.CommandAckOut().TrimStuffForCompare()));
        }
Exemple #2
0
        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();
        }
Exemple #3
0
        public void ShouldAcknowledge()
        {
            var acknowledge = JsonStrings.CommandAckOut();

            var format = Substitute.For <IProtocolWriterFormat>();

            format.Acknowledge(123123).Returns(acknowledge);

            var writer = Substitute.For <IWriteNext>();
            var reader = Substitute.For <IStormReader>();

            var subjectUnderTest = new StandardBoltWriter(writer, format, reader);

            subjectUnderTest.Acknowledge(123123);

            writer.Received().Write(acknowledge);
        }