Ejemplo n.º 1
0
        public void Sum_Returns_Sum_When_New_Line_Character_Is_Used()
        {
            var calculator = new AmountCalculator();
            var result     = calculator.Sum("1,5;2,5\n2,0");

            Assert.AreEqual(6.0m, result);
        }
Ejemplo n.º 2
0
        public void Sum_Returns_number_when_input_Is_Single()
        {
            var calculator = new AmountCalculator();
            var result     = calculator.Sum("123,1");

            Assert.AreEqual(123.1m, result);
        }
Ejemplo n.º 3
0
        public void Sum_Returns_Sum_When_The_Input_Contains_Multiple()
        {
            var calculator = new AmountCalculator();
            var result     = calculator.Sum("123,1;10,5;1,4;;");

            Assert.AreEqual(135.0m, result);
        }
Ejemplo n.º 4
0
        public void SumReturnsZeroForEmptyString()
        {
            var calculator = new AmountCalculator();
            var result     = calculator.Sum("");

            Assert.AreEqual(0m, result);
        }
Ejemplo n.º 5
0
        public void Sum_Returns_When_string_contains_letters()
        {
            var calculator = new AmountCalculator();
            var result     = calculator.Sum("12,5;1,5;abc;3,5");

            Assert.AreEqual(17.5m, result);
        }
Ejemplo n.º 6
0
        public void Sum_Returns_When_When_Defining_A_Custom_Separatror_and_string_contains_slash_as_Separator()
        {
            var calculator = new AmountCalculator();
            var result     = calculator.Sum("[___]//12,5//1,5___3,5");

            Assert.AreEqual(17.5m, result);
        }
Ejemplo n.º 7
0
        public void Sum_Returns_When_empty_numbers()
        {
            var calculator = new AmountCalculator();
            var result     = calculator.Sum("12,5;1,5;;;3,5");

            Assert.AreEqual(17.5m, result);
        }
Ejemplo n.º 8
0
        public void Sum_Returns_When_Defining_A_Custom_Separatror_In_The_Input_String()
        {
            var calculator = new AmountCalculator();
            var result     = calculator.Sum("[___]//12,5;1,5___3,5");

            Assert.AreEqual(17.5m, result);
        }