Esempio n. 1
0
        public void Add_returns_roznica2_of_given_values()
        {
            //arrange
            Matematics math = new Matematics();
            //act
            var result = math.Substract(20, 5);

            //assert
            Assert.Equal(15, result);
        }
Esempio n. 2
0
        public void Add_returns_iloczyn_of_given_values()
        {
            //arrange
            Matematics math = new Matematics();
            //act
            var result = math.Multiply(3, 4);

            //assert
            Assert.Equal(12, result);
        }
Esempio n. 3
0
        public void Add_returns_suma2_of_given_values()
        {
            //arrange
            Matematics math = new Matematics();
            //act
            var result = math.Add(10, 5);

            //assert
            Assert.Equal(15, result);
        }
Esempio n. 4
0
        [InlineData(1, 0, 1)]      // v
        public void Method_add_returns_suma_of_given_values(double x, double y, double expected)
        {
            //arrange
            var math = new Matematics();
            //act
            var result = math.Add(x, y);

            //assert
            Assert.Equal(expected, result);
        }
Esempio n. 5
0
        public void Add_returns_iloraz1_of_given_values()
        {
            //arrange
            Matematics math = new Matematics();
            //act
            var result = math.Divide(10, 5);

            //assert
            Assert.Equal(2, result);
        }
Esempio n. 6
0
        public void Add_returns_iloraz01_of_given_values()
        {
            //arrange
            Matematics math = new Matematics();
            //act
            var result = math.Divide(20, 0);

            //assert
            Assert.Equal(Double.PositiveInfinity, result);
        }
Esempio n. 7
0
        [Fact]                                         //po adnotacji Fact jest publiczna klasa, ktora nic nie zwraca
        public void Add_returns_suma_of_given_values() //nie moze nic zwracac, nazwa ma wskazywac co to robi
        //^-to jest nazwa testu to nam wywali przy podsumowaniu jesli nazwy sa zbyt dlugie i sie zawijaja, to warto sobie stworzyc wiecej kals testowych np dodawanie
        {
            //arrange <-przygotowac srodowisko testowe
            Matematics math = new Matematics();//nazwa () taka sama jak nazwa klasy .cs
            //mozna napisac var math = new Matematics();<- tak samo skompiluje
            //nowy obiekt nie byłby potrzebny jeśli klasa Matematics byłaby static

            //act
            var result = math.Add(10, 20);

            //assert <-określam czego oczekuję, wyniki // sprawdzenie kodu testowanego z tym czego oczekuję
            Assert.Equal(30, result);
        }