public void Add_GivenEmptyString_ShouldReturnZero()
 {
     var stringCalc = new StringCalc();
     var sum = stringCalc.Add("");
     const int expected = 0;
     Assert.AreEqual(expected,sum);
 }
Exemple #2
0
        static void Main(string[] args)
        {
            UserInput  usrInput  = new UserInput();
            string     usrInputs = usrInput.GetUserInput(args);
            StringCalc strCalc   = new StringCalc();
            int        total     = strCalc.AddStrings(usrInputs);

            Console.WriteLine($"Your total is: {total} {Environment.NewLine}Enter a key to close");
            Console.ReadKey();
        }
Exemple #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Please enter numbers\n");
            string numbers = Console.ReadLine();

            StringCalc objStringCalc = new StringCalc();
            int        sum           = objStringCalc.Add(numbers);

            Console.WriteLine("The sum of given numbers is: " + sum.ToString());
            Console.ReadKey();
        }
Exemple #4
0
        public void add_newline_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19_20()
        {
            StringCalc calc = new StringCalc();

            Assert.AreEqual(210, calc.Add("1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20"));
        }
Exemple #5
0
        public void add_newline()
        {
            StringCalc calc = new StringCalc();

            Assert.AreEqual(0, calc.Add("\n"));
        }
Exemple #6
0
        public void add_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19_20()
        {
            StringCalc calc = new StringCalc();

            Assert.AreEqual(210, calc.Add("1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20"));
        }
Exemple #7
0
        public void add_5_chars()
        {
            StringCalc calc = new StringCalc();

            Assert.AreEqual(5, calc.Add("5,chars"));
        }
Exemple #8
0
        public void add_1_1()
        {
            StringCalc calc = new StringCalc();

            Assert.AreEqual(2, calc.Add("1,1"));
        }
 public void Add_GivenTwoNumbers_ShouldReturnTheirSum(string numbers, int expected)
 {
     var stringCalc = new StringCalc();
     var sum = stringCalc.Add(numbers);
     Assert.AreEqual(expected,sum);
 }
 public void Add_GivenSingleNumber_ShouldReturnThatNumber(string numbers, int expected)
 {
     var stringCalc = new StringCalc();
     var sum = stringCalc.Add(numbers);
     Assert.AreEqual(expected,sum);
 }
 public void Add_GivenNewLineDelimeter_ShouldReturnSumOfNumbers(string numbers, int expected)
 {
     var stringCalc = new StringCalc();
     var sum = stringCalc.Add(numbers);
     Assert.AreEqual(expected,sum);
 }