Example #1
0
        public void MultipleDelimitersTest()
        {
            string[] test   = new string[] { "//*%\n1*2%3" };
            uint     result = NumberAddition.AddString(test);

            Assert.AreEqual(result, 6);
        }
Example #2
0
        public void NumberGreaterThanThousand()
        {
            string[] test   = new string[] { "", "1,2", "4\n5000,6" };
            uint     result = NumberAddition.AddString(test);

            Assert.AreEqual(result, 13);
        }
Example #3
0
        public void CommaAndNewLineSeparatedTest()
        {
            string[] test   = new string[] { "", "\n1,2", "4\n5,6" };
            uint     result = NumberAddition.AddString(test);

            Assert.AreEqual(result, 18);
        }
Example #4
0
        public void CommaSeparatedNumberTest()
        {
            string[] test   = new string[] { "", "1,2", "4,5,6" };
            uint     result = NumberAddition.AddString(test);

            Assert.AreEqual(result, 18);
        }
Example #5
0
        public void NumbersWithCommaAndNewLineTogetherIgnored()
        {
            // 1\n,2 is ignored
            // Only 4+5+6 combination is considered
            string[] test   = new string[] { "1\n,2", "4\n5,6" };
            uint     result = NumberAddition.AddString(test);

            Assert.AreEqual(result, 15);
        }
Example #6
0
        public void NegativeNunberTest()
        {
            string[] test = new string[] { "-1\n2,3" };

            Assert.Throws <FormatException>(() => NumberAddition.AddString(test));
        }