コード例 #1
0
        public void UserStatusCanBecheckedAfterLogin()
        {
            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.GenerateUserLoginRequest()
                               )))
            {
                response = Nol3.ReciveResponse(client);
            }

            using (var client =
                       Nol3.SendRequestSynch(
                           new Nol3Request(
                               FIXMLManager.GenerateUserStatusRequest()
                               )))
            {
                response = Nol3.ReciveResponse(client);
            }

            //cleanup - logout
            using (var client = Nol3.SendRequestSynch(new Nol3Request(
                                                          FIXMLManager.GenerateUserLogoutRequest()
                                                          )))
            {
            }

            var userResponseObject = FIXMLManager.ParseUserResponseMessege(response);

            Assert.That(userResponseObject, Is.TypeOf <UserResponse>());
            Assert.That(userResponseObject.Username, Is.EqualTo("BOS"));
            Assert.That(userResponseObject.UserStatus, Is.EqualTo(UserStatus.LoggedIn));
            Assert.That(userResponseObject.MarketDepth, Is.EqualTo(1));
        }
コード例 #2
0
        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"));
        }