Beispiel #1
0
        public void TestCustomSeparator()
        {
            var computator = new Computations();
            //Given
            string argument1 = "//#\n4#6#2";
            //When
            var result = computator.Calculate(argument1);

            //Than
            Assert.Equal(12, result, 5);
        }
Beispiel #2
0
        public void TestZeroIfEmpty()
        {
            var computator = new Computations();
            //Given
            string emptyString = string.Empty;
            //When
            var result = computator.Calculate(emptyString);

            //Than
            Assert.Equal(0, result, 5);
        }
Beispiel #3
0
        public void TestNegativeNumber()
        {
            var computator = new Computations();
            //Given
            string argument1 = "-3,4,5";

            //When

            //Than
            Assert.Throws <ArgumentException>(() => computator.Calculate(argument1));
        }
Beispiel #4
0
        public void TestIgnoreBig()
        {
            var computator = new Computations();
            //Given
            string argument1 = "3000,1000,7";
            //When
            var result = computator.Calculate(argument1);

            //Than
            Assert.Equal(1007, result, 5);
        }
Beispiel #5
0
        public void TestSplitAndAdd3()
        {
            var computator = new Computations();
            //Given
            string argument1 = "3,45,7";
            //When
            var result = computator.Calculate(argument1);

            //Than
            Assert.Equal(55, result, 5);
        }
Beispiel #6
0
        public void TestReturnWithoutChange()
        {
            var computator = new Computations();
            //Given
            string argument1 = "4";
            //When
            var result = computator.Calculate(argument1);

            //Than
            Assert.Equal(4, result, 5);
        }
Beispiel #7
0
        public void TestNSeparator()
        {
            var computator = new Computations();
            //Given
            string argument1 = "3\n5\n2";
            //When
            var result = computator.Calculate(argument1);

            //Than
            Assert.Equal(10, result, 5);
        }
Beispiel #8
0
        public void TestManySeparators()
        {
            var computator = new Computations();
            //Given
            string argument1 = "//[##],[,],[???]\n5##88???2";
            //When
            var result = computator.Calculate(argument1);

            //Than
            Assert.Equal(95, result, 5);
        }
Beispiel #9
0
        public void TestSeparatorBig()
        {
            var computator = new Computations();
            //Given
            string argument1 = "//[###]\n2###3###3";
            //When
            var result = computator.Calculate(argument1);

            //Than
            Assert.Equal(8, result, 5);
        }