Ejemplo n.º 1
0
        public void RaisesEventAfterEachMessage()
        {
            var context  = new FudgeContext();
            var messages = new FudgeMsg[]
            {
                new FudgeMsg(context, new Field("test", "data")),
                new FudgeMsg(context, new Field("life", 42))
            };
            var reader = new FudgeMsgStreamReader(context, messages);
            var writer = new FudgeMsgStreamWriter(context);

            var pipe = new FudgeStreamPipe(reader, writer);

            int count = 0;

            pipe.MessageProcessed += () =>
            {
                var message = writer.DequeueMessage();
                FudgeUtils.AssertAllFieldsMatch(messages[count], message);
                count++;
            };

            pipe.Process();

            Assert.Equal(2, count);
        }
Ejemplo n.º 2
0
        public void Unknown()
        {
            FudgeMsg inputMsg = new FudgeMsg(
                new Field("unknown", new UnknownFudgeFieldValue(new byte[10], new FudgeTypeDictionary().GetUnknownType(200))));
            FudgeMsg outputMsg = CycleMessage(inputMsg, "unknown.dat");

            FudgeUtils.AssertAllFieldsMatch(inputMsg, outputMsg);
        }
Ejemplo n.º 3
0
        public void AllNames()
        {
            FudgeMsg inputMsg  = StandardFudgeMessages.CreateMessageAllNames(fudgeContext);
            FudgeMsg outputMsg = CycleMessage(inputMsg);

            Assert.NotNull(outputMsg);

            FudgeUtils.AssertAllFieldsMatch(inputMsg, outputMsg);
        }
Ejemplo n.º 4
0
        public void SubMsg() //throws IOException
        {
            var inputMsg = StandardFudgeMessages.CreateMessageWithSubMsgs(fudgeContext);

            FudgeMsg outputMsg = CycleMessage(inputMsg);

            Assert.NotNull(outputMsg);

            FudgeUtils.AssertAllFieldsMatch(inputMsg, outputMsg);
        }
Ejemplo n.º 5
0
        /**
         * @param msg
         */
        protected void CheckResultsMatch(FudgeMsg msg, FudgeContext fudgeContext)
        {
            FudgeMsgEnvelope result = CycleMessage(fudgeContext, msg);

            Assert.NotNull(result);
            Assert.NotNull(result.Message);
            FudgeMsg resultMsg = result.Message;

            FudgeUtils.AssertAllFieldsMatch(msg, resultMsg);
        }
Ejemplo n.º 6
0
        public void AllNamesCodecNoTaxonomy()
        {
            FudgeMsg     inputMsg  = StandardFudgeMessages.CreateMessageAllNames(fudgeContext);
            FudgeContext context   = new FudgeContext();
            FudgeMsg     outputMsg = CycleMessage(inputMsg, context, null);

            Assert.NotNull(outputMsg);

            FudgeUtils.AssertAllFieldsMatch(inputMsg, outputMsg);
        }
Ejemplo n.º 7
0
        public void VariableWidthColumnSizes()
        {
            FudgeMsg inputMsg = new FudgeMsg(
                new Field("100", new byte[100]),
                new Field("1000", new byte[1000]),
                new Field("10000", new byte[100000]));                              // This field name is wrong - see FRN-67

            FudgeMsg outputMsg = CycleMessage(inputMsg, "variableWidthColumnSizes.dat");

            Assert.NotNull(outputMsg);

            FudgeUtils.AssertAllFieldsMatch(inputMsg, outputMsg);
        }
Ejemplo n.º 8
0
        public void VariableWidthColumnSizes()
        {
            FudgeMsg inputMsg = new FudgeMsg();

            inputMsg.Add("100", new byte[100]);
            inputMsg.Add("1000", new byte[1000]);
            inputMsg.Add("10000", new byte[100000]);

            FudgeMsg outputMsg = CycleMessage(inputMsg);

            Assert.NotNull(outputMsg);

            FudgeUtils.AssertAllFieldsMatch(inputMsg, outputMsg);
        }
Ejemplo n.º 9
0
        public void SubMsg() //throws IOException
        {
            var inputMsg = new FudgeMsg(
                new Field("sub1",
                          new Field("bibble", "fibble"),
                          new Field(827, "Blibble")),
                new Field("sub2",
                          new Field("bibble9", 9837438),
                          new Field(828, 82.77f)));

            FudgeMsg outputMsg = CycleMessage(inputMsg, "subMsg.dat");

            Assert.NotNull(outputMsg);

            FudgeUtils.AssertAllFieldsMatch(inputMsg, outputMsg);
        }
Ejemplo n.º 10
0
        public void FixedWidthByteArrays()
        {
            FudgeMsg inputMsg = new FudgeMsg(
                new Field("byte[4]", CreateRandomArray(4)),
                new Field("byte[8]", CreateRandomArray(8)),
                new Field("byte[16]", CreateRandomArray(16)),
                new Field("byte[20]", CreateRandomArray(20)),
                new Field("byte[32]", CreateRandomArray(32)),
                new Field("byte[64]", CreateRandomArray(64)),
                new Field("byte[128]", CreateRandomArray(128)),
                new Field("byte[256]", CreateRandomArray(256)),
                new Field("byte[512]", CreateRandomArray(512)),
                new Field("byte[28]", CreateRandomArray(28)));

            FudgeMsg outputMsg = CycleMessage(inputMsg);

            FudgeUtils.AssertAllFieldsMatch(inputMsg, outputMsg);
        }