示例#1
0
        public void TestStep1()
        {
            SumIntFromString s = new SumIntFromString();
            var n = s.Add("");

            Assert.True(n == 0, "Result is " + n);
            n = s.Add("1");
            Assert.True(n == 1);
            n = s.Add("1,2");
            Assert.True(n == 3);
        }
示例#2
0
        public void TestStep7()
        {
            SumIntFromString s = new SumIntFromString();

            Assert.True(s.Add("//[*.][%.]//1*.2%.3") == 6);
        }
示例#3
0
        public void TestStep6()
        {
            SumIntFromString s = new SumIntFromString();

            Assert.True(s.Add("//[*][%]//1*2%3") == 6);
        }
示例#4
0
        public void TestStep5()
        {
            SumIntFromString s = new SumIntFromString();

            Assert.True(s.Add("//[***]//1***2***3") == 6);
        }
示例#5
0
        public void TestStep4()
        {
            SumIntFromString s = new SumIntFromString();

            Assert.True(s.Add("1000,2") == 2);
        }
示例#6
0
        public void TestStep3()
        {
            SumIntFromString s = new SumIntFromString();

            Assert.Throws <NegativeNotAllowedException>(() => { s.Add("1,-2,3,4,5"); });
        }
示例#7
0
        public void TestStep2()
        {
            SumIntFromString s = new SumIntFromString();

            Assert.True(s.Add("1,2,3,4,5") == 15);
        }