Пример #1
0
        public void GenerateRequest_LoginMessage()
        {
            //configuration setup
            string currentID;

            using (var IDGEN = IdGenerator.GetIDGenerator())
            {
                currentID = Convert.ToString(Convert.ToInt32(IDGEN.CurrentID) + 1);
            }

            Nol3ConfigurationManager.SaveConfiguration(new Tools.Model.Nol3Configuration
            {
                ID       = Convert.ToInt32(currentID) - 1,
                Login    = "******",
                Password = "******"
            });

            string result   = FIXMLManager.GenerateUserLoginRequest();
            string expected = String.Format(@"<FIXML v=""5.0"" r=""20080317"" s=""20080314""><UserReq UserReqID=""{0}"" UserReqTyp=""1"" Username=""BOS"" Password=""BOS"" /></FIXML>", currentID);
            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 TestIfConfigurationIsSaved()
        {
            Nol3ConfigurationManager.SaveConfiguration(new Nol3Configuration {
                ID = 10
            });

            Assert.That(Nol3ConfigurationManager.ConfigurationPath, Does.Exist);
        }
Пример #3
0
 private static void SaveConfig()
 {
     Nol3ConfigurationManager.SaveConfiguration(new Tools.Model.Nol3Configuration
     {
         ID       = Convert.ToInt32(Nol3ConfigurationManager.GetConfiguration().ID),
         Login    = "******",
         Password = "******"
     });
 }
        public void TestIfConfigurationCanBeRead()
        {
            Nol3ConfigurationManager.SaveConfiguration(new Nol3Configuration {
                ID = 100
            });
            var currentConfig = Nol3ConfigurationManager.GetConfiguration();

            Assert.That(currentConfig.ID, Is.EqualTo(100));
            Assert.That(currentConfig.registryPath, Is.EqualTo(@"HKEY_CURRENT_USER\Software\COMARCH S.A.\NOL3\7\Settings"));
        }
 public void SetUp()
 {
     using (var _idGenerator = IdGenerator.GetIDGenerator())
     {
         Nol3ConfigurationManager.SaveConfiguration(new Tools.Model.Nol3Configuration
         {
             registryPath = Nol3ConfigurationManager.GetConfiguration().registryPath,
             ID           = Convert.ToInt32(_idGenerator.CurrentID)
         });
     }
     Nol3 = Nol3Connector.CreateClient(Nol3RegistryReader.Settings);
 }
Пример #6
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));
        }
        public void TestIfConfigurationPropertyCanBeChanged_Path()
        {
            Nol3ConfigurationManager.SaveConfiguration(new Nol3Configuration {
                ID           = 100,
                registryPath = "TEST"
            });
            var currentConfig = Nol3ConfigurationManager.GetConfiguration();

            //Restore to propper data
            Nol3ConfigurationManager.SaveConfiguration(new Nol3Configuration
            {
                ID           = 100,
                registryPath = @"HKEY_CURRENT_USER\Software\COMARCH S.A.\NOL3\7\Settings"
            });

            Assert.That(currentConfig.registryPath, Is.EqualTo(@"TEST"));
        }
Пример #8
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"));
        }