コード例 #1
0
        public void TestStringCreation()
        {
            ClassWithStringMember cwsm =
                PropertyValuePair.ConvertStringToType <ClassWithStringMember>("StringMember=\"Test With, comma\"");

            if (cwsm.StringMember != "Test With, comma")
            {
                throw new Exception("ConvertStringToType is not properly handling commas");
            }

            // Just making sure this doesn't throw an exception.
            string result = PropertyValuePair.ConvertStringToType
                            <string>("\"Beef = Yeah!\"");
        }
コード例 #2
0
        public void TestCreatingShortHandCustomObjects()
        {
            ClassWithStringMember cwsm =
                PropertyValuePair.ConvertStringToType <ClassWithStringMember>("StringMember=\"Test With Space\"");

            if (cwsm.StringMember != "Test With Space")
            {
                throw new Exception("ConvertStringToType is not properly handling shorthand conversions using spaces");
            }


            cwsm =
                PropertyValuePair.ConvertStringToType <ClassWithStringMember>("StringMember  =  \"Test With Space\"");

            if (cwsm.StringMember != "Test With Space")
            {
                throw new Exception("ConvertStringToType is not properly handling shorthand conversions using spaces");
            }
        }