示例#1
0
            public static List <TextConvert> CreatReader(Dictionary <int, string> str)
            {
                List <TextConvert> res = new List <TextConvert>();

                foreach (var temp in str)
                {
                    switch (temp.Key)
                    {
                    case 1:
                        TextConvert r1 = new StringConvert();
                        r1.ConvertCharacter(temp.Value);
                        res.Add(r1);
                        break;

                    case 2:
                        TextConvert r2 = new IntConvert();
                        r2.ConvertFontChange(Convert.ToInt32(temp.Value));
                        res.Add(r2);
                        break;

                    case 3:
                        TextConvert r3 = new NothingConvert();
                        r3.ConvertParagraph();
                        res.Add(r3);
                        break;
                    }
                }

                return(res);
            }
示例#2
0
 public void Convert_FormatException_Test(string number)
 {
     Assert.Throws <FormatException>(() => IntConvert.Convert(number));
 }
示例#3
0
 public void Convert_OverflowException_Test(string number)
 {
     Assert.Throws <OverflowException>(() => IntConvert.Convert(number));
 }
示例#4
0
        public void Convert_StringToInt_Test(string number, int expectedResult)
        {
            var result = IntConvert.Convert(number);

            Assert.That(result, Is.EqualTo(expectedResult));
        }