Esempio n. 1
0
        public static int Main(string[] args)
        {
            int result = -1;

            string IPAddress = getServerIP(args);

            if (IPAddress == null)
            {
                Console.Error.WriteLine("ERROR: unable to resolve IP address");
                return(-1);
            }

            int port = getPort(args);

            if (port == -1)
            {
                Console.Error.WriteLine("ERROR: unable to determine port");
                return(-1);
            }

            string testResultDir = getOutputDir(args);

            mInstance = new GameFacade();
            mockClientMessageProcessor = new MockClientMessageProcessor(IPAddress, port);
            if (FindArg(args, "/t"))
            {
                bool multiple = false;
                if (FindArg(args, "/m"))
                {
                    multiple = true;
                }

                result = UnitTestLoop(testResultDir, multiple);
            }
            else
            {
                runMockClient();
            }

            return(result);
        }
Esempio n. 2
0
        private static void ProcessPaymentItemsCommand(MockClientMessageProcessor mockClientMessageProcessor)
        {
            Dictionary <string, string> commandParameters = new Dictionary <string, string>();
            ConsoleKey key = Console.ReadKey(false).Key;

            switch (key)
            {
            case ConsoleKey.A:
                commandParameters.Add("userSession", mockClientMessageProcessor.SessionId);
                commandParameters.Add("amount", "200");
                mockClientMessageProcessor.ProcessPaymentItemCommand("AddVirtualCoinForUser", commandParameters);
                break;

            case ConsoleKey.B:
                commandParameters.Add("userSession", mockClientMessageProcessor.SessionId);
                mockClientMessageProcessor.ProcessPaymentItemCommand("GetUserBalance", commandParameters);
                break;

            case ConsoleKey.H:
                mockClientMessageProcessor.ProcessPaymentItemCommand("HealthCheck", commandParameters);
                break;

            case ConsoleKey.I:
                commandParameters.Add("userSession", mockClientMessageProcessor.SessionId);
                commandParameters.Add("startIndex", "0");
                commandParameters.Add("blockSize", "10");
                commandParameters.Add("itemTypeNames", "Pants, Bags");
                mockClientMessageProcessor.ProcessPaymentItemCommand("GetUserInventory", commandParameters);
                break;

            case ConsoleKey.S:
                commandParameters.Add("storeName", "Hangout_Store_Combined");
                commandParameters.Add("startIndex", "0");
                commandParameters.Add("blockSize", "9");
                mockClientMessageProcessor.ProcessPaymentItemCommand("GetStoreInventory", commandParameters);
                break;

            case ConsoleKey.O:
                commandParameters.Add("userSession", mockClientMessageProcessor.SessionId);
                mockClientMessageProcessor.ProcessPaymentItemCommand("GameCurrencyOffers", commandParameters);
                break;

            case ConsoleKey.P:
                commandParameters.Add("userSession", mockClientMessageProcessor.SessionId);
                commandParameters.Add("offerId", "29");
                mockClientMessageProcessor.ProcessPaymentItemCommand("PurchaseGameCurrencyPayPal", commandParameters);
                break;

            case ConsoleKey.C:
                mockClientMessageProcessor.LaunchMoneyAccountFunding();


                //     string UserId = crypt.TDesEncrypt(mockClientMessageProcessor.);

                //commandParameters.Add("userSession", mockClientMessageProcessor.SessionId);
                //commandParameters.Add("offerId", "29");
                //commandParameters.Add("creditCardNumber", "4159662533655864");
                //commandParameters.Add("creditCardType", "VISA");
                //commandParameters.Add("expireDate", "092018");
                // commandParameters.Add("securityCode", "000");
                // commandParameters.Add("firstName", "Test");
                // commandParameters.Add("lastName", "User");
                // commandParameters.Add("address", "1 Main St");
                // commandParameters.Add("city", "San Jose");
                // commandParameters.Add("state", "CA");
                // commandParameters.Add("zipCode", "95131");
                // commandParameters.Add("countryCode", "US");
                // commandParameters.Add("phoneNumber", "1234567890");
                //  mockClientMessageProcessor.ProcessPaymentItemCommand("PurchaseGameCurrencyCreditCard", commandParameters);
                break;


            case ConsoleKey.X:
                commandParameters.Add("userSession", mockClientMessageProcessor.SessionId);
                commandParameters.Add("currencyName", "VCOIN");
                commandParameters.Add("offerIds", "2207");
                mockClientMessageProcessor.ProcessPaymentItemCommand("PurchaseItems", commandParameters);
                break;


            case ConsoleKey.G:
                commandParameters.Add("userSession", mockClientMessageProcessor.SessionId);
                commandParameters.Add("currencyName", "HOUTS");
                commandParameters.Add("offerIds", "82");
                commandParameters.Add("recipientUserId", "549");
                commandParameters.Add("noteToRecipient", "This is a Gift");
                mockClientMessageProcessor.ProcessPaymentItemCommand("PurchaseItemsGift", commandParameters);
                break;

            case ConsoleKey.T:
                RunSystemUnitTests tests = new RunSystemUnitTests();
                tests.RunTests("");
                break;

            case ConsoleKey.F1:
                Console.WriteLine("*** Payment Commands: ***\n");
                Console.WriteLine("A  AddVirtualCoinForUser 200 VCOIN ");
                Console.WriteLine("B  GetUserBalance ");
                Console.WriteLine("C  PurchaseGameCurrencyCreditCard ");
                Console.WriteLine("G  PurchaseItemsGift ");
                Console.WriteLine("I  GetUserInventory ");
                Console.WriteLine("O  PurchaseGameCurrencyOffers ");
                Console.WriteLine("P  PurchaseGameCurrencyPayPal ");
                Console.WriteLine("S  GetStoreInventory ");
                Console.WriteLine("T  Automated Server Tests ");
                Console.WriteLine("X  PurchaseItems ");
                break;

            default:
                break;
            }
        }