Ejemplo n.º 1
0
        public void IgnoreValuesGreaterThan1000ReturnsSum()
        {
            //Arrange
            Calculator calc = new Calculator();
            string input = "10,20,\n30,1000,1001";
            //Act
            double answer = calc.Sum(input);

            //Assert
            Assert.AreEqual(1060.0, answer, 0.0001);
        }
Ejemplo n.º 2
0
        public void EmptyStringReturnsSumZero()
        {
            //Arrange
            Calculator calc = new Calculator();
            string input = "";
            //Act
            double answer = calc.Sum(input);

            //Assert
            Assert.AreEqual(0.0, answer,0.0001);
        }
Ejemplo n.º 3
0
        public void NegativeNumbersCastsException()
        {
            //Arrange
            Calculator calc = new Calculator();

            string input = "10\n-20,30";
            //Act
            double answer = calc.Sum(input);
        }
Ejemplo n.º 4
0
        public void TwoValuesWithNewLineStringReturnsSum()
        {
            //Arrange
            Calculator calc = new Calculator();
            string input = "10\n20";
            //Act
            double answer = calc.Sum(input);

            //Assert
            Assert.AreEqual(30.0, answer, 0.0001);
        }
Ejemplo n.º 5
0
        public void SingleValueStringReturnsValue()
        {
            //Arrange
            Calculator calc = new Calculator();
            string input = "10";
            //Act
            double answer = calc.Sum(input);

            //Assert
            Assert.AreEqual(10.0, answer, 0.0001);
        }