Example #1
0
        public void RequestMemberStatus_Valid()
        {
            ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
            ResponsePacket            packet = server.ProcessAction(GenerateTestRequestMemberPacket("MEMBER_STATUS"));

            Assert.IsNotNull(packet);
        }
Example #2
0
        public void RequestAddServiceCode_Valid()
        {
            ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
            ResponsePacket            packet = server.ProcessAction(GenerateServiceCodePacket("ADD_SERVICE_CODE"));

            Assert.IsNotNull(packet);
        }
Example #3
0
        public void RequestAddProvider_Valid()
        {
            ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
            ResponsePacket            packet = server.ProcessAction(GenerateTestProviderPacket("ADD_PROVIDER"));

            Assert.IsNotNull(packet);
        }
Example #4
0
        public void RequestRequestCustomMember_Valid()
        {
            ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
            ResponsePacket            packet = server.ProcessAction(GenerateReportDateRangePacket("CUSTOM_MEMBER_REPORT"));

            Assert.IsNotNull(packet);
        }
Example #5
0
        public void RequestAddInvoice_Valid()
        {
            ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
            ResponsePacket            packet = server.ProcessAction(GenerateTestInvoicePacket("ADD_INVOICE"));

            Assert.IsNotNull(packet);
        }
Example #6
0
        public void RequestRequestCustomProvider_Valid()
        {
            ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();

            ResponsePacket packet = server.ProcessAction(GenerateReportDateRangePacket("CUSTOM_PROVIDER_REPORT"));

            //Assert.IsNotNull(packet);
            Assert.AreNotEqual(packet, null);
        }
Example #7
0
        /// <summary>
        /// Build a login packet from user input from the packet factory. Send
        /// the packet to the server for processing. The server will send back a
        /// session id if login was successful.
        /// </summary>
        /// <returns>True</returns>
        private bool LoginUpdate()
        {
            if (tui == null)
            {
                // Exception.
            }
            LoginPacket loginPacket = null;

            // Build a login packet.
            if (MockMode == true)
            {
                loginPacket = MockPacket as LoginPacket;
            }
            else
            {
                loginPacket = packetFactory.BuildPacket(
                    tui, "LoginPacket", "", "", "", AccessLevel()) as LoginPacket;
            }

            // Send the packet to the server and instantiate a response.
            ResponsePacket responsePacket = server.ProcessAction(loginPacket);

            if (MockMode == true)
            {
                MockPacket = responsePacket as ResponsePacket;
            }

            // Get the session id from the response packet.
            this.sessionID = responsePacket.Data();

            // If we got a valid session from the server (md5 is length 32)
            if (this.sessionID.Length == 32)
            {
                // Login! Success!
                userID = loginPacket.ID();

                // Change state to menu.
                currentState = TerminalState.MENU;
            }
            else
            {
                // Something went wrong with login information, show the operator the response.
                WriteResponse(responsePacket);
            }
            return(MockMode == true ? false : true);
        }
Example #8
0
 public void ProcessAction_Invalid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     Assert.ThrowsException <ArgumentNullException>(() => server.ProcessAction(null));
     return;
 }
Example #9
0
 public void RequestProviderDirectory_Valid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     ResponsePacket            packet = server.ProcessAction(
         new BasePacket("VIEW_PROVIDER_DIRECTORY", "1234"));
 }
Example #10
0
 public void UpdateServiceCode_Valid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     ResponsePacket            packet = server.ProcessAction(GenerateServiceCodePacket("UPDATE_SERVICE_CODE"));
 }
Example #11
0
 public void UpdateServiceCode_Invalid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     Assert.ThrowsException <ArgumentException>(() =>
                                                server.ProcessAction(GenerateTestInvoicePacket("UPDATE_SERVICE_CODE")));
 }
Example #12
0
 public void UpdateProvider_Valid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     ResponsePacket            packet = server.ProcessAction(GenerateTestProviderPacket("UPDATE_PROVIDER"));
 }
Example #13
0
 public void UpdateProvider_Invalid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     Assert.ThrowsException <ArgumentException>(() =>
                                                server.ProcessAction(GenerateTestInvoicePacket("UPDATE_PROVIDER")));
 }
Example #14
0
 public void RequestRemoveProvider_Valid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     ResponsePacket            packet = server.ProcessAction(GenerateTestProviderPacket("REMOVE_PROVIDER"));
 }
Example #15
0
 public void UpdateMember_Valid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     ResponsePacket            packet = server.ProcessAction(GenerateTestMemberPacket("UPDATE_MEMBER"));
 }
Example #16
0
 public void RequestRemoveMember_Valid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     ResponsePacket            packet = server.ProcessAction(GenerateTestMemberPacket("REMOVE_MEMBER"));
 }
Example #17
0
 public void RequestRemoveMember_Invalid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     Assert.ThrowsException <ArgumentException>(() =>
                                                server.ProcessAction(GenerateTestInvoicePacket("REMOVE_MEMBER")));
 }
Example #18
0
 public void RequestAddProvider_Invalid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     Assert.ThrowsException <ArgumentException>(() =>
                                                server.ProcessAction(GenerateTestMemberPacket("ADD_PROVIDER")));
 }
Example #19
0
 public void RequestMemberStatus_Invalid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     Assert.ThrowsException <ArgumentException>(() =>
                                                server.ProcessAction(GenerateTestInvoicePacket("MEMBER_STATUS")));
 }
Example #20
0
 public void RequestAddServiceCode_Invalid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     Assert.ThrowsException <ArgumentException>(() =>
                                                server.ProcessAction(GenerateTestMemberPacket("ADD_SERVICE_CODE")));
 }
Example #21
0
 public void RequestMainAccountingProcedure_Valid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     ResponsePacket            packet = server.ProcessAction(
         new BasePacket("MAIN_ACCOUNTING_PROCEDURE", "1234"));
 }
Example #22
0
 public void RequestRequestCustomMember_Invalid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     Assert.ThrowsException <ArgumentException>(() =>
                                                server.ProcessAction(GenerateTestMemberPacket("CUSTOM_MEMBER_REPORT")));
 }