public void ChineseNumberToInt()
 {
     Assert.Equal(2_376_053, ChineseNumberHelper.ChineseNumberToInt("两百三十七万六千零五十三"));
     Assert.Equal(2_000_013, ChineseNumberHelper.ChineseNumberToInt("两百万零一十三"));
     Assert.Equal(1250, ChineseNumberHelper.ChineseNumberToInt("一千二百五"));
     Assert.Equal(1205, ChineseNumberHelper.ChineseNumberToInt("一千二百零五"));
     Assert.Equal(12000, ChineseNumberHelper.ChineseNumberToInt("一万二"));
     Assert.Equal(10002, ChineseNumberHelper.ChineseNumberToInt("一万零二"));
     Assert.Equal(10020, ChineseNumberHelper.ChineseNumberToInt("一万零二十"));
     Assert.Equal(10200, ChineseNumberHelper.ChineseNumberToInt("一万零二百"));
     Assert.Equal(13000, ChineseNumberHelper.ChineseNumberToInt("一万零三千"));
     Assert.Equal(10350, ChineseNumberHelper.ChineseNumberToInt("一万三百五"));
     Assert.Equal(1, ChineseNumberHelper.ChineseNumberToInt("一"));
     Assert.Equal(9, ChineseNumberHelper.ChineseNumberToInt("九"));
     Assert.Equal(10, ChineseNumberHelper.ChineseNumberToInt("十"));
     Assert.Equal(13, ChineseNumberHelper.ChineseNumberToInt("十三"));
     Assert.Equal(80, ChineseNumberHelper.ChineseNumberToInt("八十"));
     Assert.Equal(23, ChineseNumberHelper.ChineseNumberToInt("二十三"));
     Assert.Equal(181, ChineseNumberHelper.ChineseNumberToInt("一百八十一"));
     Assert.Equal(100, ChineseNumberHelper.ChineseNumberToInt("一百"));
     Assert.Equal(1000, ChineseNumberHelper.ChineseNumberToInt("一千"));
 }
Exemple #2
0
 protected override int?ParseRawNumber(string rawNumber)
 {
     return(ChineseNumberHelper.ChineseNumberToInt(rawNumber));
 }