Exemplo n.º 1
0
        public void Integral_nEqualsZero_ReturnException()
        {
            //Arrange
            int a = 1;
            int b = 50;
            CancellationToken token;
            Progress <int>    progress = new Progress <int>();
            string            exp_res  = "Значение не попадает в ожидаемый диапазон.";
            int     n     = 0;
            Trapeze trap1 = new Trapeze();

            //Act
            double act = trap1.Calculate(n, a, b, token, progress, (z) =>
            {
                return((10 * z) - Math.Log(14 * z));
            }).Result;
            //Assert
            string actual = trap1.ErrorInformation;

            Assert.AreEqual(exp_res, actual);
        }
Exemplo n.º 2
0
        public async Task Integral_aIsBiggerThanb_ReturnException()
        {
            //Arrange
            int a = 50;
            int b = 1;
            CancellationToken token;
            Progress <int>    progress = new Progress <int>();
            string            exp_res  = "Значение не попадает в ожидаемый диапазон.";
            int     n     = 10000;
            Trapeze trap1 = new Trapeze();

            //Act
            double act = await trap1.Calculate(n, a, b, token, progress, (z) =>
            {
                return((10 * z) - Math.Log(14 * z));
            });

            //Assert
            string actual = trap1.ErrorInformation;

            Assert.AreEqual(exp_res, actual);
        }