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!\""); }
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"); } }