コード例 #1
0
ファイル: TestRectangle.cs プロジェクト: malsimity/Integral-1
        public void Integral_Rectangle_XX_0_10_BadN()
        {
            //arrange
            double      a      = 0;
            double      b      = 10;
            int         n      = -1000000;
            ICalculator calcul = new RectangleCalculator();

            //act
            double actual = calcul.Calculate(a, b, n, x => x * x);
        }
コード例 #2
0
 [ExpectedException(typeof(ArgumentException))] // 5 означает что выдаст исключение
 public void Intergrate_xx_negative_n()
 {
     // Arrange
     double a = 0;
     double b = a;
     long   n = -10;
     RectangleCalculator   rectangleCalculator = new RectangleCalculator();
     Func <double, double> f = x => x * x;
     // Act
     double actual = rectangleCalculator.Calculate(a, b, n, f);
 }
コード例 #3
0
ファイル: TestRectangle.cs プロジェクト: malsimity/Integral-1
        public void Integral_Rectangle_0_0_10_Correct()
        {
            //arrange
            double      expected = 0;
            double      a        = 0;
            double      b        = 10;
            int         n        = 10000;
            ICalculator calcul   = new RectangleCalculator();

            //act
            double actual = calcul.Calculate(a, b, n, x => 0);

            //assert
            Assert.AreEqual(expected, actual, 0.001);
        }
コード例 #4
0
ファイル: TestRectangle.cs プロジェクト: malsimity/Integral-1
        public void Integral_Rectangle_XX_0_10_Correct()
        {
            //arrange подготовить
            double      expected = 333.333;
            double      a        = 0;
            double      b        = 10;
            int         n        = 10000;
            ICalculator calcul   = new RectangleCalculator();

            //act действие
            double actual = calcul.Calculate(a, b, n, x => x * x);

            //assert
            Assert.AreEqual(expected, actual, 0.001);
        }
コード例 #5
0
        public void Intergrate_xx_Gives_0_For_Rectangle() // 3 проверка 0 для прямоугольников
        {
            //arrange
            double expected = 0;
            double a        = 0;
            double b        = a;
            long   n        = 100000;
            RectangleCalculator   rectangleCalculator = new RectangleCalculator();
            Func <double, double> f = x => x * x;
            //act
            double actual = rectangleCalculator.Calculate(a, b, n, f);

            //assert
            Assert.AreEqual(expected, actual, 0.0001);
        }
コード例 #6
0
ファイル: UnitTest1.cs プロジェクト: Mon-A-Moore/Graphic
        public void RectangleCalculator_Right()
        {
            //arrange
            double expected = 174591.027;
            int    a        = 1;
            int    b        = 100;
            int    n        = 100000;
            RectangleCalculator   rectangleCalculator = new RectangleCalculator();
            Func <double, double> f = x => 35 * x - Math.Log(10 * x) + 2;

            //act
            double actual = rectangleCalculator.Calculate(a, b, n, f);

            //accert
            Assert.AreEqual(expected, actual, 0.001);
        }
コード例 #7
0
ファイル: UnitTest1.cs プロジェクト: Strannik-37/Integral
        public void Correct_Rectangle_Method_2()
        {
            //arrange
            double expected = 54197.59134;
            double a        = 1;
            double b        = 100;
            long   n        = 10000;
            RectangleCalculator   rectangleCalculator = new RectangleCalculator();
            Func <double, double> f = x => 11 * x - Math.Log(11 * x) - 2;

            //act
            double actual = rectangleCalculator.Calculate(a, b, n, f);

            //assert

            Assert.AreEqual(expected, actual, 0.0001);
        }
コード例 #8
0
ファイル: UnitTest1.cs プロジェクト: Strannik-37/Integral
        public void Correct_Rectangle_Method_1()
        {
            //arrange
            double expected = 36458.33333;
            double a        = 25;
            double b        = 50;
            long   n        = 10000;
            RectangleCalculator   rectangleCalculator = new RectangleCalculator();
            Func <double, double> f = x => x * x;

            //act
            double actual = rectangleCalculator.Calculate(a, b, n, f);

            //assert

            Assert.AreEqual(expected, actual, 0.0001);
        }
コード例 #9
0
ファイル: UnitTest1.cs プロジェクト: Mon-A-Moore/Graphic
        public void Error_if_a_and_b_below_zero()
        {
            double expected         = 174591.027;
            int    a                = -1;
            int    b                = -100;
            int    n                = 100;
            Func <double, double> f = x => 35 * x - Math.Log(10 * x) + 2;

            RectangleCalculator RectangleCalculator = new RectangleCalculator();
            TrapCalculator      TrapCalculator      = new TrapCalculator();
            SimpsonCalculator   SimpsonCalculator   = new SimpsonCalculator();

            //act
            double actual1 = RectangleCalculator.Calculate(a, b, n, f);
            double actual2 = TrapCalculator.Calculate(a, b, n, f);
            double actual3 = SimpsonCalculator.Calculate(a, b, n, f);
        }
コード例 #10
0
        public void Intergrate_xx_Gives_Correct_Result()
        {
            //arrange
            double expected = 333_333.3333;
            double a        = 0;
            double b        = 100;
            long   n        = 100000;
            RectangleCalculator   rectangleCalculator = new RectangleCalculator();
            Func <double, double> f = x => x * x;

            //act
            double actual = rectangleCalculator.Calculate(a, b, n, f);

            //assert

            Assert.AreEqual(expected, actual, 0.0001);
        }
コード例 #11
0
        public void Intergrate_xx_negative_n()
        {
            //arrange
            double expected = 0;
            double a        = 0;
            double b        = 100;

            long n = -10;
            RectangleCalculator   rectangleCalculator = new RectangleCalculator();
            Func <double, double> f = x => x * x;

            //act
            double actual = rectangleCalculator.Calculate(a, b, n, f);

            //assert
            Assert.AreEqual(expected, actual, 0.0001);
        }