コード例 #1
0
        public void TestWithNull()
        {
            string[] request = null;

            Dictionary <string, string> result = CommandLineFunctions.GetCommandLineParameters(request);

            Assert.AreEqual(0, result.Count);
        }
コード例 #2
0
        public void TestWithOneBadParameter()
        {
            string[] request = new string[]
            {
                "1212"
            };

            Dictionary <string, string> result = CommandLineFunctions.GetCommandLineParameters(request);

            Assert.AreEqual(0, result.Count);
        }
コード例 #3
0
        public void TestWithThreeBadParameters()
        {
            string[] request = new string[]
            {
                "1212",
                "847tyhperuogij",
                "9w874r78u8ijogrek",
            };

            Dictionary <string, string> result;

            result = CommandLineFunctions.GetCommandLineParameters(request);

            Assert.AreEqual(0, result.Count);
        }
コード例 #4
0
        public static void Init(StartupEventArgs startupEventArgs)
        {
            KeyValuePair <string, string> item;

            Dictionary <string, string> commandLineParameters = new Dictionary <string, string>();

            //
            commandLineParameters = CommandLineFunctions.GetCommandLineParameters(startupEventArgs);

            // Locale
            item = commandLineParameters.Where(x => x.Key == "locale").FirstOrDefault();
            if (item.Key != null && item.Value != null)
            {
                CoreData.RequestedLocale = item.Value;
            }
        }
コード例 #5
0
        public void TestWithStrangKeyNames()
        {
            string[] request = new string[]
            {
                "&^*^%=!@#@#!",
                "!======"
            };

            Dictionary <string, string> expectedResult = new Dictionary <string, string>()
            {
                { "&^*^%", "!@#@#!" },
                { "!", "=====" }
            };

            Dictionary <string, string> result = CommandLineFunctions.GetCommandLineParameters(request);

            CollectionAssert.AreEqual(expectedResult, result);
        }
コード例 #6
0
        public void TestWithOneBadAndOneGoodParameter()
        {
            string[] request = new string[]
            {
                "1212",
                "x=x"
            };

            Dictionary <string, string> expectedResult = new Dictionary <string, string>()
            {
                { "x", "x" }
            };

            Dictionary <string, string> result;

            result = CommandLineFunctions.GetCommandLineParameters(request);

            CollectionAssert.AreEqual(expectedResult, result);
        }
コード例 #7
0
        public void TestWithKeyNameWithSpace()
        {
            string[] request = new string[]
            {
                "1 =1212",
                "222 =847tyhperuogij",
                "    iwrjiowjrtw ==9w874r78u8ijogrek",
                " test =key1=z1=z2",
            };

            Dictionary <string, string> expectedResult = new Dictionary <string, string>()
            {
                { "1", "1212" },
                { "222", "847tyhperuogij" },
                { "iwrjiowjrtw", "=9w874r78u8ijogrek" },
                { "test", "key1=z1=z2" }
            };

            Dictionary <string, string> result = CommandLineFunctions.GetCommandLineParameters(request);

            CollectionAssert.AreEqual(expectedResult, result);
        }