示例#1
0
        public void RequestAddProvider_Valid()
        {
            ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
            ResponsePacket            packet = server.ProcessAction(GenerateTestProviderPacket("ADD_PROVIDER"));

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

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

            Assert.IsNotNull(packet);
        }
示例#4
0
        public void RequestMemberStatus_Valid()
        {
            ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
            ResponsePacket            packet = server.ProcessAction(GenerateTestRequestMemberPacket("MEMBER_STATUS"));

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

            Assert.IsNotNull(packet);
        }
示例#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);
        }
示例#7
0
        public void TestGetMD5Hash()
        {
            string str = "abcdefg";
            string md5 = "7ac66c0f148de9519b8bd264312c4d64";

            ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
            PrivateObject             obj    = new PrivateObject(server);
            string retVal = obj.Invoke("GetMD5Hash", str).ToString();

            Assert.AreEqual(retVal, md5);
            return;
        }
示例#8
0
        /// <summary>
        /// Initialize all data members.
        /// </summary>
        public OperatorTerminal(Boolean isFake = false)
        {
            this.isFake = isFake;

            // Set up the default window size.
            columnSize = (int)((float)Console.LargestWindowWidth / 2f);
            rowSize    = (int)((float)Console.LargestWindowHeight / 1.4f);

            if (!isFake)
            {
                Console.SetWindowSize(columnSize + 1, rowSize + 2);
            }

            // Create the text ui instance.
            tui = new TextUI(rowSize, columnSize, isFake);

            // Default state is login.
            currentState = TerminalState.LOGIN;

            // Setup the array of updateDelegates.
            updateDelegates = new UpdateDelegate[(int)TerminalState.COUNT];

            // Set each updateDelegate.
            updateDelegates[(int)TerminalState.LOGIN] = LoginUpdate;
            updateDelegates[(int)TerminalState.MENU]  = MenuUpdate;

            // Initially, no user logged in.
            sessionID = "";
            userID    = "";

            // Generate a server instance.
            server = new ChocAnServer.ChocAnServer();

            // Generate a packet factory instance.
            packetFactory = new PacketFactory();
        }
示例#9
0
 public void RequestAddProvider_Invalid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     Assert.ThrowsException <ArgumentException>(() =>
                                                server.ProcessAction(GenerateTestMemberPacket("ADD_PROVIDER")));
 }
示例#10
0
 public void RequestProviderDirectory_Valid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     ResponsePacket            packet = server.ProcessAction(
         new BasePacket("VIEW_PROVIDER_DIRECTORY", "1234"));
 }
示例#11
0
 public void UpdateServiceCode_Invalid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     Assert.ThrowsException <ArgumentException>(() =>
                                                server.ProcessAction(GenerateTestInvoicePacket("UPDATE_SERVICE_CODE")));
 }
示例#12
0
 public void ProcessAction_Invalid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     Assert.ThrowsException <ArgumentNullException>(() => server.ProcessAction(null));
     return;
 }
示例#13
0
 public void UpdateProvider_Invalid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     Assert.ThrowsException <ArgumentException>(() =>
                                                server.ProcessAction(GenerateTestInvoicePacket("UPDATE_PROVIDER")));
 }
示例#14
0
 public void UpdateServiceCode_Valid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     ResponsePacket            packet = server.ProcessAction(GenerateServiceCodePacket("UPDATE_SERVICE_CODE"));
 }
示例#15
0
 public void UpdateMember_Valid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     ResponsePacket            packet = server.ProcessAction(GenerateTestMemberPacket("UPDATE_MEMBER"));
 }
示例#16
0
 public void UpdateProvider_Valid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     ResponsePacket            packet = server.ProcessAction(GenerateTestProviderPacket("UPDATE_PROVIDER"));
 }
示例#17
0
 public void RequestRemoveMember_Invalid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     Assert.ThrowsException <ArgumentException>(() =>
                                                server.ProcessAction(GenerateTestInvoicePacket("REMOVE_MEMBER")));
 }
示例#18
0
 public void RequestRemoveProvider_Valid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     ResponsePacket            packet = server.ProcessAction(GenerateTestProviderPacket("REMOVE_PROVIDER"));
 }
示例#19
0
 public void RequestRemoveMember_Valid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     ResponsePacket            packet = server.ProcessAction(GenerateTestMemberPacket("REMOVE_MEMBER"));
 }
示例#20
0
 public void RequestAddServiceCode_Invalid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     Assert.ThrowsException <ArgumentException>(() =>
                                                server.ProcessAction(GenerateTestMemberPacket("ADD_SERVICE_CODE")));
 }
示例#21
0
 public void RequestMemberStatus_Invalid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     Assert.ThrowsException <ArgumentException>(() =>
                                                server.ProcessAction(GenerateTestInvoicePacket("MEMBER_STATUS")));
 }
示例#22
0
 public void RequestRequestCustomMember_Invalid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     Assert.ThrowsException <ArgumentException>(() =>
                                                server.ProcessAction(GenerateTestMemberPacket("CUSTOM_MEMBER_REPORT")));
 }
示例#23
0
 public void RequestMainAccountingProcedure_Valid()
 {
     ChocAnServer.ChocAnServer server = new ChocAnServer.ChocAnServer();
     ResponsePacket            packet = server.ProcessAction(
         new BasePacket("MAIN_ACCOUNTING_PROCEDURE", "1234"));
 }