/// <summary> /// Write the packet response to the screen space. Including the session id, /// action performed, any packet data, and the response text from the server. /// </summary> /// <param name="packet"></param> protected void WriteResponse(ResponsePacket packet) { if (packet == null) { throw new ArgumentNullException("packet", "Response packet was null for reading."); } // Write the response packet to the screen buffer. tui.WriteLine("\n \n \t[Response]"); tui.WriteLine(packet.ToString()); tui.WriteLine("\n \nPress any to continue.", TextUI.TextUIJustify.CENTER); // Set the footer message. tui.Footer = " " + packet.Response() + " "; // Refresh the screen to see what our response was. tui.Refresh(); //Wait for any single key to be pressed by the user. if (!isFake) { Console.ReadKey(); } return; }
public void TestResponsePacketConstructor() { string action = "Add Member"; string sessionID = "1209384209385"; string data = "This is super important data >_>'"; string response = "The member 123456789 was succesfully added."; ResponsePacket testPacket = new ResponsePacket(action, sessionID, data, response); Assert.AreEqual(data, testPacket.Data()); Assert.AreEqual(response, testPacket.Response()); return; }
public void LoginUpdate_GoodUserAndPass_ResponseSuccess() { OperatorTerminal.EnableMock(); OperatorTerminal.ChangeMockState(OperatorTerminal.TerminalState.LOGIN); OperatorTerminal.ChangeMockPacket(new LoginPacket("LOGIN", "", "123456789", "asdf", 1)); OperatorTerminal operatorTerminal = new OperatorTerminal(true); operatorTerminal.Loop(); // I set the MockPacket to a response pack when mock mode is enabled. ResponsePacket response = OperatorTerminal.MockPacket as ResponsePacket; Assert.AreEqual(response.Response(), "Login Successful"); OperatorTerminal.DisableMock(); return; }