Example #1
0
        public void GenerateRequest_Generic_EmptyData()
        {
            string result   = FIXMLManager.GenerateRequestMessage <EmptyTestClass>(new EmptyTestClass());
            string expected = @"<FIXML v=""5.0"" r=""20080317"" s=""20080314""><UserReq /></FIXML>";
            var    sb       = new StringBuilder();

            sb.AppendLine(String.Format("RESULT     : {0}", result));
            sb.AppendLine(String.Format("EXPECTED: {0}", expected));

            TestContext.WriteLine(sb.ToString());
            Assert.That(result, Is.EqualTo(expected));
        }
Example #2
0
        public void GenerateRequest_BizMsgRej()
        {
            string result = FIXMLManager.GenerateRequestMessage <BusinessMessageReject>(new BusinessMessageReject()
            {
                BusinessRejectReason = Convert.ToString(BusinessRejectReason.ApplicatonCanNotBeAccessed),
                RefMsgType           = RefMsgType.LoggingUnlogging,
                Text = "TEST Message"
            },
                                                                                        FIXMLManager.GenerateXMLAttributeOverride("BizMsgRej", typeof(ROOTFIXML <BusinessMessageReject>)));

            string expected = @"<FIXML v=""5.0"" r=""20080317"" s=""20080314""><BizMsgRej RefMsgTyp=""BE"" BizRejRsn=""4"" Txt=""TEST Message"" /></FIXML>";
            var    sb       = new StringBuilder();

            sb.AppendLine(String.Format("RESULT     : {0}", result));
            sb.AppendLine(String.Format("EXPECTED: {0}", expected));

            TestContext.WriteLine(sb.ToString());
            Assert.That(result, Is.EqualTo(expected));
        }
Example #3
0
        public void GenerateRequest_UserResponse()
        {
            string result = FIXMLManager.GenerateRequestMessage <UserResponse>(new UserResponse()
            {
                Username       = "******",
                UserRequestID  = "101",
                MarketDepth    = 1,
                UserStatus     = UserStatus.Other,
                UserStatusText = "TEST"
            },
                                                                               FIXMLManager.GenerateXMLAttributeOverride("UserRsp", typeof(ROOTFIXML <UserResponse>)));

            string expected = @"<FIXML v=""5.0"" r=""20080317"" s=""20080314""><UserRsp UserReqID=""101"" Username=""BOS"" UserStat=""6"" UserStatText=""TEST"" MktDepth=""1"" /></FIXML>";
            var    sb       = new StringBuilder();

            sb.AppendLine(String.Format("RESULT     : {0}", result));
            sb.AppendLine(String.Format("EXPECTED: {0}", expected));

            TestContext.WriteLine(sb.ToString());
            Assert.That(result, Is.EqualTo(expected));
        }
        public void Nol3BusinessMessageRejectIParsedProperlyfromResponse()
        {
            string currentID;

            //prepare config
            using (var IDGen = IdGenerator.GetIDGenerator())
            {
                currentID = IDGen.CurrentID;

                Nol3ConfigurationManager.SaveConfiguration(new Tools.Model.Nol3Configuration
                {
                    ID       = Convert.ToInt32(IDGen.ID),
                    Login    = "******",
                    Password = "******"
                });
            }
            string response;

            using (var client =
                       Nol3.SendRequestSynch(
                           new Nol3Request(
                               FIXMLManager.GenerateRequestMessage <UserRequest>(
                                   new UserRequest {
                UserRequestType = 666
            }
                                   ))))
            {
                response = Nol3.ReciveResponse(client);
            }

            var userResponseObject = FIXMLManager.ParseBusinessMessageRejectMessage(response);

            Assert.That(userResponseObject, Is.TypeOf <BusinessMessageReject>());
            Assert.That(userResponseObject.BusinessRejectReason, Is.EqualTo(BusinessRejectReason.XMLParsingError));
            Assert.That(userResponseObject.Text, Is.EqualTo("UserReqID have to be integer"));
        }