Example #1
0
        public void TestJoin()
        {
            Assert.Equal("1,2,3", String.Join(new List<int> {1, 2, 3}));
            Assert.Equal("'1','2','3'", String.Join(new List<int> {1, 2, 3}, "'"));
            Assert.Equal("123", String.Join(new List<int> {1, 2, 3}, "", ""));
            Assert.Equal("\"1\",\"2\",\"3\"", String.Join(new List<int> {1, 2, 3}, "\""));
            Assert.Equal("1 2 3", String.Join(new List<int> {1, 2, 3}, "", " "));
            Assert.Equal("1;2;3", String.Join(new List<int> {1, 2, 3}, "", ";"));
            Assert.Equal("1,2,3", String.Join(new List<string> {"1", "2", "3"}));
            Assert.Equal("'1','2','3'", String.Join(new List<string> {"1", "2", "3"}, "'"));

            var list = new List<Guid>
            {
                new Guid("83B0233C-A24F-49FD-8083-1337209EBC9A"),
                new Guid("EAB523C6-2FE7-47BE-89D5-C6D440C3033A")
            };
            Assert.Equal("83B0233C-A24F-49FD-8083-1337209EBC9A,EAB523C6-2FE7-47BE-89D5-C6D440C3033A".ToLower(),
                String.Join(list));
            Assert.Equal("'83B0233C-A24F-49FD-8083-1337209EBC9A','EAB523C6-2FE7-47BE-89D5-C6D440C3033A'".ToLower(),
                String.Join(list, "'"));
        }
Example #2
0
 public void TestPinYin(string input, string result)
 {
     Assert.Equal(result, String.PinYin(input));
 }
Example #3
0
 public void TestFirstLowerCase(string value, string result)
 {
     Assert.Equal(result, String.FirstLowerCase(value));
 }
Example #4
0
 /// <summary>
 ///     测试初始化
 /// </summary>
 public StringTest()
 {
     Builder = new String();
 }