public void ShouldEmitWithAnchorsNoStream()
        {
            var subjectUnderTest = new JsonProtocolWriterFormat();
            var emitJson =
                subjectUnderTest.EmitCommand(new object[] { "field1", 2, 3 }, new long[] { 1231231, -234234234 }, 9);

            Assert.That(
                emitJson,
                Is.EqualTo(JsonStrings.CommandEmitWithAnchorNoStream().TrimStuffForCompare()));
        }
        public void ShouldEmitAll()
        {
            var subjectUnderTest = new JsonProtocolWriterFormat();
            var emitJson =
                subjectUnderTest.EmitCommand(new object[] { "field1", 2, 3 }, 1231231, 9, 1.ToString(CultureInfo.InvariantCulture));

            Assert.That(
                emitJson,
                Is.EqualTo(JsonStrings.CommandEmitAll().TrimStuffForCompare()));
        }
        public void ShouldEmitNoStreamNoTaskNoId()
        {
            var subjectUnderTest = new JsonProtocolWriterFormat();
            var emitJson =
                subjectUnderTest.EmitCommand(new object[] { "field1", 2, 3 });

            Assert.That(
                emitJson,
                Is.EqualTo(JsonStrings.CommandEmitNoStreamNoTaskNoId().TrimStuffForCompare()));
        }
        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 ShouldHaveCorrectAcknowledgeString()
 {
     var subjectUnderTest = new JsonProtocolWriterFormat();
     Assert.That(subjectUnderTest.Acknowledge(1231231).TrimStuffForCompare(),
         Is.EqualTo(JsonStrings.CommandAckOut().TrimStuffForCompare()));
 }
 public void ShouldHaveCorrectSyncString()
 {
     var subjectUnderTest = new JsonProtocolWriterFormat();
     Assert.That(subjectUnderTest.Sync().TrimStuffForCompare(),
         Is.EqualTo(JsonStrings.CommandSyncOut().TrimStuffForCompare()));
 }
 public void ShouldHaveCorrectPidString()
 {
     var subjectUnderTest = new JsonProtocolWriterFormat();
     Assert.That(subjectUnderTest.ProcessId(1234).TrimStuffForCompare(),
         Is.EqualTo(JsonStrings.PidOut().TrimStuffForCompare()));
 }
 public void ShouldHaveCorrectLogString()
 {
     var subjectUnderTest = new JsonProtocolWriterFormat();
     Assert.That(subjectUnderTest.LogInfo("hello world!").TrimStuffForCompare(),
         Is.EqualTo(JsonStrings.CommandLogOut().TrimStuffForCompare()));
 }
 public void ShouldHaveCorrectErrorString()
 {
     var subjectUnderTest = new JsonProtocolWriterFormat();
     Assert.That(subjectUnderTest.LogError("ERROR!!!!!!").TrimStuffForCompare(),
         Is.EqualTo(JsonStrings.CommandErrorOut().TrimStuffForCompare()));
 }