Exemple #1
0
        public void TestMockSignonSetup_BadData()
        {
            IRpcBroker broker = MockRpcBrokerFactory.GetXusSignonSetupBroker(false);

            XusSignonSetupCommand testCommand = new XusSignonSetupCommand(broker);

            RpcResponse response = testCommand.Execute();

            // *** Check results ***
            Assert.IsNotNull(response);
            Assert.AreEqual(RpcResponseStatus.Fail, response.Status);
        }
        protected void SignonToBroker(IRpcBroker broker, int avCodeIndex)
        {
            XusSignonSetupCommand signonSetupCommand = new XusSignonSetupCommand(broker);

            RpcResponse response = signonSetupCommand.Execute();

            Assert.AreEqual(RpcResponseStatus.Success, response.Status);

            XusAvCodeCommand avCodeCommand = new XusAvCodeCommand(broker);

            avCodeCommand.AddCommandArguments(TestConfiguration.ValidAccessCodes[avCodeIndex], TestConfiguration.ValidVerifyCodes[avCodeIndex]);

            response = avCodeCommand.Execute();

            Assert.AreEqual(RpcResponseStatus.Success, response.Status);
        }
        public LoginResult GetLoginData()
        {
            // *** Get the login setup ***

            LoginResult returnVal = new LoginResult();

            if (this.broker != null)
            {
                // *** Signon Setup ***
                XusSignonSetupCommand setupCmd = new XusSignonSetupCommand(this.broker);
                setupCmd.Execute();

                // *** Check status ***
                if (setupCmd.Response.Status == RpcResponseStatus.Success)
                {
                    returnVal.LoginData.SetSignonSetup(setupCmd.SignonSetup);

                    // *** Get Intro Message ***
                    XusIntroMsgCommand cmdIntro = new XusIntroMsgCommand(this.broker);
                    cmdIntro.Execute();

                    // *** Check status ***
                    if (cmdIntro.Response.Status == RpcResponseStatus.Success)
                    {
                        // *** Set the login message ***
                        returnVal.LoginData.IntroMessage = cmdIntro.Response.Data;

                        returnVal.SetResult(true, "");
                    }
                    else
                    {
                        returnVal.LoginData.IntroMessage = cmdIntro.Response.InformationalMessage;
                        returnVal.SetResult(false, cmdIntro.Response.InformationalMessage);
                    }
                }
                else
                {
                    returnVal.SetResult(false, setupCmd.Response.InformationalMessage);
                }
            }
            else
            {
                returnVal.SetResult(false, "No Broker");
            }

            return(returnVal);
        }
Exemple #4
0
        public void TestMockSignonSetup_GoodData()
        {
            IRpcBroker broker = MockRpcBrokerFactory.GetXusSignonSetupBroker(true);

            XusSignonSetupCommand testCommand = new XusSignonSetupCommand(broker);

            RpcResponse response = testCommand.Execute();

            // *** Check results ***
            Assert.IsNotNull(response);
            Assert.AreEqual(RpcResponseStatus.Success, response.Status);
            Assert.IsFalse(string.IsNullOrWhiteSpace(testCommand.SignonSetup.DomainName));
            Assert.IsFalse(string.IsNullOrWhiteSpace(testCommand.SignonSetup.Port));
            Assert.IsFalse(string.IsNullOrWhiteSpace(testCommand.SignonSetup.ServerName));
            Assert.IsFalse(string.IsNullOrWhiteSpace(testCommand.SignonSetup.UCI));
            Assert.IsFalse(string.IsNullOrWhiteSpace(testCommand.SignonSetup.Volume));
        }
        public void TestSignonSetup()
        {
            Queue <CommandBase> commandQueue = new Queue <CommandBase>();

            using (RpcBroker broker = GetConnectedBroker())
            {
                XusSignonSetupCommand testCommand = new XusSignonSetupCommand(broker);

                commandQueue.Enqueue(testCommand);

                RpcResponse response = ExecuteCommandQueue(commandQueue);

                // *** Check results ***
                Assert.AreEqual(RpcResponseStatus.Success, response.Status);
                Assert.IsFalse(string.IsNullOrWhiteSpace(testCommand.SignonSetup.DomainName));
                Assert.IsFalse(string.IsNullOrWhiteSpace(testCommand.SignonSetup.Port));
                Assert.IsFalse(string.IsNullOrWhiteSpace(testCommand.SignonSetup.ServerName));
                Assert.IsFalse(string.IsNullOrWhiteSpace(testCommand.SignonSetup.UCI));
                Assert.IsFalse(string.IsNullOrWhiteSpace(testCommand.SignonSetup.Volume));

                broker.Disconnect();
            }
        }
        // TODO:...
        //[TestMethod]
        public void TestChangeVerifyCode()
        {
            string    accessCode;
            string    verifyCode;
            const int userIndex = 1;

            using (RpcBroker broker = GetConnectedBroker())
            {
                XusSignonSetupCommand setupCommand = new XusSignonSetupCommand(broker);

                RpcResponse response = setupCommand.Execute();

                if (response.Status == RpcResponseStatus.Success)
                {
                    accessCode = ValidAccessCodes[userIndex];
                    verifyCode = ValidVerifyCodes[userIndex];

                    XusAvCodeCommand avCommand = new XusAvCodeCommand(broker);

                    avCommand.AddCommandArguments(accessCode, verifyCode);

                    response = avCommand.Execute();

                    if ((response.Status == RpcResponseStatus.Success) || (avCommand.SignonResults.MustChangeVerifyCode))
                    {
                        // *** Automatically generated verify codes are in format "dss%####" ***
                        int numericPart;
                        if (int.TryParse(verifyCode.Substring(4), out numericPart))
                        {
                            numericPart += 1;

                            string newVCode = numericPart.ToString("DSS\\%000000000");

                            XusCvcCommand cvcCommand = new XusCvcCommand(broker);

                            cvcCommand.AddCommandArguments(verifyCode, newVCode, newVCode);

                            response = cvcCommand.Execute();

                            if (response.Status == RpcResponseStatus.Success)
                            {
                                string[] verifyCodes = (string[])ValidVerifyCodes.Clone();

                                verifyCodes[userIndex] = newVCode;
                                ValidVerifyCodes       = verifyCodes;
                            }                            // *** Check results ***
                            Assert.AreEqual(RpcResponseStatus.Success, response.Status);
                        }
                    }
                    else
                    {
                        Assert.Fail("XusAvCodeCommand failed");
                    }
                }
                else
                {
                    Assert.Fail("XusSignonSetupCommand failed");
                }

                broker.Disconnect();
            }
        }