示例#1
0
        public void ShouldEmitWithAnchorsAll()
        {
            var subjectUnderTest = new JsonProtocolWriterFormat();
            var emitJson         =
                subjectUnderTest.EmitCommand(new object[] { "field1", 2, 3 }, new long[] { 1231231, -234234234 }, 9, 1.ToString(CultureInfo.InvariantCulture));

            Assert.That(
                emitJson,
                Is.EqualTo(JsonStrings.CommandEmitWithAnchorAll().TrimStuffForCompare()));
        }
示例#2
0
        public void ShouldEmitAndReturnTaskIdsBecauseNotDirect()
        {
            var tuple   = new Object[0];
            var anchors = new long[0];
            var emit    = JsonStrings.CommandEmitWithAnchorAll();

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

            format.EmitCommand(tuple, anchors, null, "1").Returns(emit);

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

            reader.ReadTaskIds().Returns(new long[] { 1, 2, 3 });

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

            Assert.That(subjectUnderTest.EmitTuple(tuple, anchors, "1"), Is.EquivalentTo(new long[] { 1, 2, 3 }));

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