Example #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);
        }
Example #2
0
        public void TestStep7()
        {
            SumIntFromString s = new SumIntFromString();

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

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

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

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

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

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