Example #1
0
        public void If_Parameter_Is_Less_1_Then_Return_Less_1()
        {
            // Arrange
            int negativeNumber = -5;

            // Act
            int fibonnaciResult = Mathematic.Fibonnaci(negativeNumber);

            // Assert
            Assert.AreEqual(fibonnaciResult, -1);
        }
Example #2
0
        public void If_Parameter_Is_More_Than_100_Then_Return_Less_1()
        {
            // Arrange
            int numberMoreThan100 = 101;

            // Act
            int fibonnaciResult = Mathematic.Fibonnaci(numberMoreThan100);

            // Assert
            Assert.AreEqual(fibonnaciResult, -1);
        }
Example #3
0
        public void If_Parameter_Between_1_And_100_Then_Return_Fibonnaci_Result()
        {
            // Arrange
            int number = 8;

            // Act
            int fibonnaciResult = Mathematic.Fibonnaci(number);

            // Assert
            Assert.AreEqual(fibonnaciResult, 21);
        }
Example #4
0
        public async Task <IActionResult> PostFutureResult(Mathematic mathematic)
        {
            mathematic.BigNumber = mathematic.RandomNumber(100, 700);

            await _context.Mathematic.AddAsync(mathematic);

            var math = await _context.Mathematic.ToListAsync();

            if (math.Count >= 1)
            {
                return(NoContent());
            }
            await _context.SaveChangesAsync();

            return(Ok(mathematic));
        }
Example #5
0
        static void Main(string[] args)
        {
            Mathematic <double> operation = new Mathematic <double>();

            while (true)
            {
                Console.WriteLine("первое число"); double num1 = double.Parse(Console.ReadLine());
                Console.WriteLine("второе число"); double num2 = double.Parse(Console.ReadLine());
                Console.WriteLine(@" Выберите команду:
                1  Плюс        +
                2  Минус       -
                3  Умножение   *
                4  Деление     /
                5  Выход  !");


                switch (Console.ReadLine())
                {
                case "+":
                    Console.Write(operation.DelSum(num1, num2));
                    break;

                case "-":
                    Console.Write(operation.DelMin(num1, num2));
                    break;

                case "*":
                    Console.Write(operation.DelMul(num1, num2));
                    break;

                case "/":
                    Console.Write(operation.DelDiv(num1, num2));
                    break;

                case "!": return;
                }
                Console.ReadLine();
            }
        }
 public int Fibonacci(int n)
 {
     return(Mathematic.Fibonnaci(n));
 }
Example #7
0
 public void NutonSqrt_Test(double number, int exp, double eps)
 {
     Assert.AreEqual(Mathematic.NutonSqrt(number, exp, eps), Math.Pow(number, (1 / (double)exp)), eps);
 }
        public void NutonSqrt_Number625Exp4_5Return()
        {
            double result = Mathematic.NutonSqrt(625, 4, 0.01);

            Assert.AreEqual(result, 5, 0.01);
        }