public void ValidateDateAndTimeFields()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
            QuickFix.FIX44.MessageFactory          f  = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = { "8=FIX.4.4", "9=104", "35=W",  "34=3",         "49=sender",        "52=20110909-09:09:09.999", "56=target",
                                   "55=sym",    "268=1", "269=0", "272=20111012", "273=22:15:30.444", "10=19" };
            string   msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType     = "W";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);

            message.FromString(msgStr, true, dd, dd, f);

            try
            {
                dd.Validate(message, beginString, msgType);
            }
            catch (QuickFix.TagException e)
            {
                Console.WriteLine(e.ToString());
                Console.WriteLine(e.Field);
                throw;
            }
        }
        public void ValidateWrongTypeInNestedRepeatingGroup()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary();
            dd.LoadFIXSpec("FIX44");
            QuickFix.FIX44.MessageFactory f = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = { "8=FIX.4.4",          "9=185", "35=J",  "34=3",  "49=sender", "52=20110909-09:09:09.999", "56=target",
                                   "70=AllocID",         "71=0",  "626=1", "857=0", "54=1",      "55=sym",                   "53=1",     "6=5.5","75=20110909-09:09:09.999",
                                   "73=1",               // NoOrders
                                   "11=clordid",
                                   "756=1",              // NoNested2PartyIDs
                                   "757=nested2partyid",
                                   "759=failboat",       // supposed to be a int
                                   "10=48" };
            string   msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType     = "J";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);

            message.FromString(msgStr, true, dd, dd, f);

            Assert.That(() => dd.Validate(message, beginString, msgType), Throws.TypeOf <QuickFix.IncorrectDataFormat>());
        }
        public void ValidateTimeOnly_Invalid()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
            QuickFix.FIX44.MessageFactory          f  = new QuickFix.FIX44.MessageFactory();

            // intentionally invalid MDEntryTime (272/TimeOnly)
            string[] msgFields = { "8=FIX.4.4", "9=113", "35=W",  "34=3",         "49=sender",                 "52=20110909-09:09:09.999", "56=target",
                                   "55=sym",    "268=1", "269=0", "272=20111012", "273=20111012-22:15:30.444", "10=200" };
            string   msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType     = "W";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);

            message.FromString(msgStr, true, dd, dd, f);

            Assert.That(() => dd.Validate(message, beginString, msgType), Throws.TypeOf <QuickFix.IncorrectDataFormat>());
        }
        public void ValidateWrongType()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
            QuickFix.FIX44.MessageFactory          f  = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = { "8=FIX.4.4",  "9=120",  "35=D", "34=3",                     "49=sender", "52=20110909-09:09:09.999", "56=target",
                                   "11=clordid", "55=sym", "54=1", "60=20110909-09:09:09.999", "40=1",
                                   "38=failboat",// should be a decimal
                                   "10=64" };
            string   msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType     = "D";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);

            message.FromString(msgStr, true, dd, dd, f);

            Assert.That(() => dd.Validate(message, beginString, msgType), Throws.TypeOf <QuickFix.IncorrectDataFormat>());
        }
示例#5
0
        public void ValidateDateOnly_Invalid()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
            QuickFix.FIX44.MessageFactory          f  = new QuickFix.FIX44.MessageFactory();

            // intentionally invalid MDEntryDate (272/DateOnly)
            string[] msgFields = { "8=FIX.4.4", "9=117", "35=W",  "34=3",                      "49=sender",        "52=20110909-09:09:09.999", "56=target",
                                   "55=sym",    "268=1", "269=0", "272=20111012-22:15:30.444", "273=22:15:30.444", "10=175" };
            string   msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType     = "W";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);

            message.FromString(msgStr, true, dd, dd, f);

            // this should throw
            dd.Validate(message, beginString, msgType);
        }
        public void RequiredComponentRequiredField()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
            QuickFix.FIX44.MessageFactory          f  = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = { "8=FIX.4.4", "9=76", "35=7", "34=3", "49=sender", "52=20110909-09:09:09.999", "56=target",
                                   "2=AdvId",   "5=N",  "4=B",  "53=1", "10=138" };
            string   msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType     = "7";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);

            message.FromString(msgStr, true, dd, dd, f);

            var ex = Assert.Throws <QuickFix.RequiredTagMissing>(delegate { dd.Validate(message, beginString, msgType); });

            Assert.AreEqual(55, ex.Field);
        }
        [Test] // Issue #66
        public void ValidateMultipleValueStringType_Invalid()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
            QuickFix.FIX44.MessageFactory          f  = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = { "8=FIX.4.4", "9=99",  "35=W",       "34=3",  "49=sender", "52=20110909-09:09:09.999", "56=target",
                                   "55=sym",
                                   "268=1",     "269=0", "270=123.23", "271=2", "277=A 1",
                                   "10=196" };
            string   msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType     = "W";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);

            message.FromString(msgStr, true, dd, dd);

            Assert.That(() => dd.Validate(message, beginString, msgType), Throws.TypeOf <QuickFix.IncorrectTagValue>());
        }
        public void ValidateDateTime_Invalid()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary();
            dd.LoadFIXSpec("FIX44");
            QuickFix.FIX44.MessageFactory f = new QuickFix.FIX44.MessageFactory();

            // intentionally invalid SendingTime (52/DateTime)
            string[] msgFields = { "8=FIX.4.4", "9=91",  "35=W",  "34=3",         "49=sender",        "52=20110909", "56=target",
                                   "55=sym",    "268=1", "269=0", "272=20111012", "273=22:15:30.444", "10=51" };
            string   msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType     = "W";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);

            message.FromString(msgStr, true, dd, dd, f);

            Assert.That(() => dd.Validate(message, beginString, msgType), Throws.TypeOf <QuickFix.IncorrectDataFormat>());
        }
        [Test] // Issue #66
        public void ValidateMultipleValueStringType()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary();
            dd.LoadFIXSpec("FIX44");
            QuickFix.FIX44.MessageFactory f = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = { "8=FIX.4.4", "9=99",  "35=W",       "34=3",  "49=sender", "52=20110909-09:09:09.999", "56=target",
                                   "55=sym",
                                   "268=1",     "269=0", "270=123.23", "271=2", "277=A B",
                                   "10=213" };
            string   msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType     = "W";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);

            message.FromString(msgStr, true, dd, dd);

            dd.Validate(message, beginString, msgType);
        }
        public void OptionalComponentRequiredField()
        {
            // issue #98 - message erroneously rejected because DD says that
            //   component-required field is missing even though component is not present

            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
            QuickFix.FIX44.MessageFactory          f  = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = { "8=FIX.4.4",      "9=77",  "35=AD", "34=3", "49=sender", "52=20110909-09:09:09.999", "56=target",
                                   "568=tradereqid", "569=0", "10=109" };
            string   msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType     = "AD";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);

            message.FromString(msgStr, true, dd, dd, f);

            dd.Validate(message, beginString, msgType);
        }
        [Test] // Issue #282 investigation
        public void ValidateTagSpecifiedWithoutAValue()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX42.xml");
            QuickFix.FIX44.MessageFactory          f  = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = { "8=FIX.4.2", "9=65", "35=B", "34=3", "49=sender", "52=20110909-09:09:09.999", "56=target",
                                   "148=",      "33=0", "10=188" };
            string   msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType     = "B";
            string beginString = "FIX.4.2";

            Message message = f.Create(beginString, msgType);

            message.FromString(msgStr, true, dd, dd);

            dd.CheckFieldsHaveValues = true;
            Assert.Throws <QuickFix.NoTagValue>(delegate { dd.Validate(message, beginString, msgType); });

            dd.CheckFieldsHaveValues = false;
            Assert.DoesNotThrow(delegate { dd.Validate(message, beginString, msgType); });
        }
        public void ValidateWrongTypeInRepeatingGroup()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
            QuickFix.FIX44.MessageFactory          f  = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = { "8=FIX.4.4",   "9=111", "35=V",  "34=3", "49=sender", "52=20110909-09:09:09.999", "56=target",
                                   "262=mdreqid", "263=0", "264=5",
                                   "267=1",        // MDReqGrp
                                   "269=failboat", // should be a char
                                   "146=1",        // InstrmtMDReqGrp
                                   "55=sym",
                                   "10=91" };
            string   msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType     = "V";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);

            message.FromString(msgStr, true, dd, dd, f);

            Assert.That(() => dd.Validate(message, beginString, msgType), Throws.TypeOf <QuickFix.IncorrectDataFormat>());
        }
示例#13
0
        public void ValidateWrongType()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
            QuickFix.FIX44.MessageFactory f = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = {"8=FIX.4.4", "9=120", "35=D", "34=3", "49=sender", "52=20110909-09:09:09.999", "56=target",
                                   "11=clordid", "55=sym", "54=1", "60=20110909-09:09:09.999", "40=1",
                                   "38=failboat", // should be a decimal
                                   "10=64"};
            string msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType = "D";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);
            message.FromString(msgStr, true, dd, dd, f);

            dd.Validate(message, beginString, msgType);
        }
示例#14
0
        public void ValidateTimeOnly_Invalid()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
            QuickFix.FIX44.MessageFactory f = new QuickFix.FIX44.MessageFactory();

            // intentionally invalid MDEntryTime (272/TimeOnly)
            string[] msgFields = { "8=FIX.4.4", "9=113", "35=W", "34=3", "49=sender", "52=20110909-09:09:09.999", "56=target",
                                     "55=sym", "268=1", "269=0", "272=20111012", "273=20111012-22:15:30.444", "10=200" };
            string msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType = "W";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);
            message.FromString(msgStr, true, dd, dd, f);

            // this should throw
            dd.Validate(message, beginString, msgType);
        }
示例#15
0
        public void ValidateDateAndTimeFields()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
            QuickFix.FIX44.MessageFactory f = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = { "8=FIX.4.4", "9=104", "35=W", "34=3", "49=sender", "52=20110909-09:09:09.999", "56=target",
                                     "55=sym", "268=1", "269=0", "272=20111012", "273=22:15:30.444", "10=19" };
            string msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType = "W";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);
            message.FromString(msgStr, true, dd, dd, f);

            try
            {
                dd.Validate(message, beginString, msgType);
            }
            catch (QuickFix.TagException e)
            {
                Console.WriteLine(e.ToString());
                Console.WriteLine(e.Field);
                throw;
            }
        }
示例#16
0
        public void RequiredComponentRequiredField()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
            QuickFix.FIX44.MessageFactory f = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = { "8=FIX.4.4", "9=76", "35=7", "34=3", "49=sender", "52=20110909-09:09:09.999", "56=target",
                                     "2=AdvId", "5=N", "4=B", "53=1", "10=138" };
            string msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType = "7";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);
            message.FromString(msgStr, true, dd, dd, f);

            var ex = Assert.Throws<QuickFix.RequiredTagMissing>(delegate { dd.Validate(message, beginString, msgType); });
            Assert.AreEqual(55, ex.Field);
        }
示例#17
0
        public void OptionalComponentRequiredField()
        {
            // issue #98 - message erroneously rejected because DD says that
            //   component-required field is missing even though component is not present

            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
            QuickFix.FIX44.MessageFactory f = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = { "8=FIX.4.4", "9=77", "35=AD", "34=3", "49=sender", "52=20110909-09:09:09.999", "56=target",
                                     "568=tradereqid", "569=0", "10=109" };
            string msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType = "AD";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);
            message.FromString(msgStr, true, dd, dd, f);

            dd.Validate(message, beginString, msgType);
        }
示例#18
0
        public void ValidateMultipleValueStringType_Invalid()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary( "../../../spec/fix/FIX44.xml" );
            QuickFix.FIX44.MessageFactory f = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = {"8=FIX.4.4", "9=99", "35=W", "34=3", "49=sender", "52=20110909-09:09:09.999", "56=target",
                                   "55=sym",
                                   "268=1", "269=0", "270=123.23", "271=2", "277=A 1", 
                                   "10=196"};
            string msgStr = String.Join( Message.SOH, msgFields ) + Message.SOH;

            string msgType = "W";
            string beginString = "FIX.4.4";

            Message message = f.Create( beginString, msgType );
            message.FromString( msgStr, true, dd, dd );

            dd.Validate( message, beginString, msgType );
        }
示例#19
0
        [Test] // Issue #282 investigation
        public void ValidateTagSpecifiedWithoutAValue()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX42.xml");
            QuickFix.FIX44.MessageFactory f = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = {"8=FIX.4.2", "9=65", "35=B", "34=3", "49=sender", "52=20110909-09:09:09.999", "56=target",
                                   "148=", "33=0", "10=188"};
            string msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType = "B";
            string beginString = "FIX.4.2";

            Message message = f.Create(beginString, msgType);
            message.FromString(msgStr, true, dd, dd);

            dd.CheckFieldsHaveValues = true;
            Assert.Throws<QuickFix.NoTagValue>(delegate { dd.Validate(message, beginString, msgType); });

            dd.CheckFieldsHaveValues = false;
            Assert.DoesNotThrow(delegate { dd.Validate(message, beginString, msgType); });
        }
示例#20
0
        public void ValidateWrongTypeInNestedRepeatingGroup()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
            QuickFix.FIX44.MessageFactory f = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = {"8=FIX.4.4", "9=185", "35=J", "34=3", "49=sender", "52=20110909-09:09:09.999", "56=target",
                                     "70=AllocID", "71=0", "626=1", "857=0", "54=1", "55=sym", "53=1", "6=5.5", "75=20110909-09:09:09.999",
                                     "73=1", // NoOrders
                                       "11=clordid",
                                       "756=1", // NoNested2PartyIDs
                                         "757=nested2partyid",
                                         "759=failboat", // supposed to be a int
                                     "10=48"};
            string msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType = "J";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);
            message.FromString(msgStr, true, dd, dd, f);

            dd.Validate(message, beginString, msgType);
        }
示例#21
0
        public void ValidateWrongTypeInRepeatingGroup()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
            QuickFix.FIX44.MessageFactory f = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = {"8=FIX.4.4", "9=111", "35=V", "34=3", "49=sender", "52=20110909-09:09:09.999", "56=target",
                                      "262=mdreqid", "263=0", "264=5",
                                      "267=1", // MDReqGrp
                                        "269=failboat", // should be a char
                                      "146=1", // InstrmtMDReqGrp
                                        "55=sym",
                                      "10=91"};
            string msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType = "V";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);
            message.FromString(msgStr, true, dd, dd, f);

            dd.Validate(message, beginString, msgType);
        }
示例#22
0
        public void ValidateDateTime_Invalid()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
            QuickFix.FIX44.MessageFactory f = new QuickFix.FIX44.MessageFactory();

            // intentionally invalid SendingTime (52/DateTime)
            string[] msgFields = { "8=FIX.4.4", "9=91", "35=W", "34=3", "49=sender", "52=20110909", "56=target",
                                     "55=sym", "268=1", "269=0", "272=20111012", "273=22:15:30.444", "10=51" };
            string msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType = "W";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);
            message.FromString(msgStr, true, dd, dd, f);

            Assert.That(() => dd.Validate(message, beginString, msgType), Throws.TypeOf<QuickFix.IncorrectDataFormat>());
        }