public void TestFailedGetUserInfo() { Queue <CommandBase> commandQueue = new Queue <CommandBase>(); using (RpcBroker broker = GetConnectedBroker()) { commandQueue.Enqueue(new XusSignonSetupCommand(broker)); XusAvCodeCommand avCommand = new XusAvCodeCommand(broker); avCommand.AddCommandArguments(ValidAccessCodes[0], ValidVerifyCodes[0]); //commandQueue.Enqueue(avCommand); XusGetUserInfoCommand userInfoCommand = new XusGetUserInfoCommand(broker); commandQueue.Enqueue(userInfoCommand); RpcResponse response = ExecuteCommandQueue(commandQueue); // *** Check results *** Assert.AreEqual(RpcResponseStatus.Fail, response.Status); broker.Disconnect(); } }
public void TestUserInfoCommand() { Queue <CommandBase> commandQueue = new Queue <CommandBase>(); using (RpcBroker broker = GetConnectedBroker()) { commandQueue.Enqueue(new XusSignonSetupCommand(broker)); XusAvCodeCommand avCommand = new XusAvCodeCommand(broker); avCommand.AddCommandArguments(TestConfiguration.ValidAccessCodes[2], TestConfiguration.ValidVerifyCodes[2]); commandQueue.Enqueue(avCommand); OrwuUserInfoCommand testCommand = new OrwuUserInfoCommand(broker); commandQueue.Enqueue(testCommand); RpcResponse response = ExecuteCommandQueue(commandQueue); // *** Check results *** Assert.AreEqual(RpcResponseStatus.Success, response.Status); Assert.IsTrue((testCommand.UserInfo.Timeout > 0)); broker.Disconnect(); } }
private void TestDivisionSet(int userIndex, string divId, RpcResponseStatus expectedResponse) { Queue <CommandBase> commandQueue = new Queue <CommandBase>(); using (RpcBroker broker = GetConnectedBroker()) { commandQueue.Enqueue(new XusSignonSetupCommand(broker)); XusAvCodeCommand avCommand = new XusAvCodeCommand(broker); avCommand.AddCommandArguments(ValidAccessCodes[userIndex], ValidVerifyCodes[userIndex]); commandQueue.Enqueue(avCommand); XusDivisionSetCommand divCommand = new XusDivisionSetCommand(broker, divId); commandQueue.Enqueue(divCommand); RpcResponse response = ExecuteCommandQueue(commandQueue); // *** Check results *** Assert.AreEqual(expectedResponse, response.Status); broker.Disconnect(); } }
private void TestAvCode(bool goodData, RpcResponseStatus expectedStatus) { IRpcBroker broker = MockRpcBrokerFactory.GetXusAvCodeBroker(goodData); XusAvCodeCommand testCommand = new XusAvCodeCommand(broker); testCommand.AddCommandArguments("", ""); RpcResponse response = testCommand.Execute(); // *** Check results *** Assert.IsNotNull(response); Assert.AreEqual(expectedStatus, response.Status, response.InformationalMessage); }
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 PerformLogin(Login loginData) { LoginResult returnResult = new LoginResult(); returnResult.LoginData = loginData; if (this.broker != null) { // *** Verify AV Codes *** XusAvCodeCommand avCodeCommand = new XusAvCodeCommand(this.broker); avCodeCommand.AddCommandArguments(loginData.AccessCode, loginData.VerifyCode); avCodeCommand.Execute(); // *** Check status *** if (avCodeCommand.Response.Status == RpcResponseStatus.Success) { // *** Get user info *** XusGetUserInfoCommand getUserCommand = new XusGetUserInfoCommand(this.broker); getUserCommand.Execute(); // *** Check status *** if (getUserCommand.Response.Status == RpcResponseStatus.Success) { loginData.UserName = getUserCommand.UserInfo.StandardName; returnResult.SetResult(true, ""); } else { loginData.LoginMessage = getUserCommand.Response.InformationalMessage; returnResult.SetResult(false, getUserCommand.Response.InformationalMessage); } } else { loginData.LoginMessage = avCodeCommand.Response.InformationalMessage; returnResult.SetResult(false, avCodeCommand.Response.InformationalMessage); } if (avCodeCommand.SignonResults.MustChangeVerifyCode == true) { loginData.ChangeVerifyCode = avCodeCommand.SignonResults.MustChangeVerifyCode; } } return(returnResult); }
private void TestAvCode(string accessCode, string verifyCode, RpcResponseStatus expectedStatus) { Queue <CommandBase> commandQueue = new Queue <CommandBase>(); using (RpcBroker broker = GetConnectedBroker()) { commandQueue.Enqueue(new XusSignonSetupCommand(broker)); XusAvCodeCommand testCommand = new XusAvCodeCommand(broker); testCommand.AddCommandArguments(accessCode, verifyCode); commandQueue.Enqueue(testCommand); RpcResponse response = ExecuteCommandQueue(commandQueue); // *** Check results *** Assert.AreEqual(expectedStatus, response.Status, response.InformationalMessage); broker.Disconnect(); } }
public void TestSuccessfulGetUserInfo() { Queue <CommandBase> commandQueue = new Queue <CommandBase>(); using (RpcBroker broker = GetConnectedBroker()) { commandQueue.Enqueue(new XusSignonSetupCommand(broker)); XusAvCodeCommand avCommand = new XusAvCodeCommand(broker); avCommand.AddCommandArguments(ValidAccessCodes[2], ValidVerifyCodes[2]); commandQueue.Enqueue(avCommand); XusGetUserInfoCommand userInfoCommand = new XusGetUserInfoCommand(broker); commandQueue.Enqueue(userInfoCommand); RpcResponse response = ExecuteCommandQueue(commandQueue); // *** Check results *** Assert.AreEqual(RpcResponseStatus.Success, response.Status); Assert.IsFalse(string.IsNullOrWhiteSpace(userInfoCommand.UserInfo.DUZ), "DUZ is empty"); Assert.IsFalse(string.IsNullOrWhiteSpace(userInfoCommand.UserInfo.Division.Name), "Division is empty"); Assert.IsFalse(string.IsNullOrWhiteSpace(userInfoCommand.UserInfo.DTime), "DTime is empty"); Assert.IsFalse(string.IsNullOrWhiteSpace(userInfoCommand.UserInfo.Name), "Name is empty"); Assert.IsFalse(string.IsNullOrWhiteSpace(userInfoCommand.UserInfo.ServiceSection), "ServiceSection is empty"); Assert.IsFalse(string.IsNullOrWhiteSpace(userInfoCommand.UserInfo.StandardName), "StandardName is empty"); Assert.IsFalse(string.IsNullOrWhiteSpace(userInfoCommand.UserInfo.Title), "Title is empty"); // TODO: Do we care about this? //Assert.IsFalse(string.IsNullOrWhiteSpace(userInfoCommand.UserInfo.Language), "Language is empty"); //Assert.IsFalse(string.IsNullOrWhiteSpace(userInfoCommand.UserInfo.UserClass), "UserClass is empty"); //Assert.IsFalse(string.IsNullOrWhiteSpace(userInfoCommand.UserInfo.Vpid), "Vpid is empty"); //Assert.IsFalse(string.IsNullOrWhiteSpace(userInfoCommand.UserInfo.DefaultLocation), "DefaultLocation is empty"); 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(); } }